E-TE0601 — Tuple element cannot be interpreted as an expression

Error Type

Type Error

Phase

building expressions from Python

Python exception

TypeError (builtin)

Message

Expected a tuple of expressions, but the element at position `{index}` (counting from 0) has type `{type_name}`, which cannot be interpreted as an expression.

Possible fix: make every element of the tuple a number, a placeholder, a decision variable, or an expression.

({index} is the 0-based position of the offending element; {type_name} is its Python type)

Cause

A tuple was passed where an expression is expected, and one of its elements could not itself be interpreted as an expression. Tuples are accepted in expression positions and converted element by element into a tuple-valued expression — for example when reducing a fixed collection of terms, or when a callable used as an expression returns a tuple. The {index} part locates the failing element (counting from 0), and {type_name} names its Python type.

Fix

Use the reported position and type to identify the offending element, then replace it with an accepted kind: an expression, a number, a placeholder, a decision variable, a nested tuple/list/dict of expressions, a slice, or a callable taking at least one argument.

# jm.sum((x[0], x[1], my_data_object))   # raises E-TE0601 for the last element
jm.sum((x[0], x[1], W))                  # every element is expression-like