E-TE0006 — Could not infer type

Error Type

Type Error

Phase

type checking the model

Python exception

jijmodeling.TypeError

Message

Could not infer the type of `{expr}`.

Possible fix: use it in a context that determines its type (for example, apply the function to a concrete set or domain).

Cause

The type checker could not determine the type of an expression from its context. This typically happens for a lambda (function) whose argument type cannot be inferred from how it is used.

When checking a function whose result type depends on its argument, this error can also occur if its argument pattern unpacks an empty multidimensional array into no variables and the body’s type cannot be inferred independently. The empty pattern may occur inside a larger pattern.

Fix

Use the function in a context that determines its argument type — for example, pass it together with a domain= to problem.Constraint(...), or apply it via jm.map/jm.filter/jm.genarray to a concrete set or shape. Python lambdas cannot carry type annotations that JijModeling can read, so the surrounding context must supply the type.

For the empty-pattern case, bind that array to a single variable instead of unpacking it with an empty pattern, including when it occurs inside a larger pattern.