xai-org/x-algorithm · error · TypeError
Unsupported type: {type(self.jitted)}.
Error message
Unsupported type: {type(self.jitted)}. What it means
Wrapped.trace() only works on a raw (untraced, uncompiled) jit function; passing an already Traced or Compiled object raises TypeError since tracing an abstract stage twice is not supported.
Source
Thrown at phoenix/xrex/utils/aot.py:677
all_compiled = {n: _compile_or_load(n, t, metrics) for n, t in all_traced.items()}
return all_compiled, metrics
class JittedOrCompiled(Wrapped):
__slots__: tuple[str, ...] = ("jitted", "fun_name")
def __init__(self, jitted, name=None):
self.fun_name = name
self.jitted = jitted
def lower(self, *args, **kwargs):
if isinstance(self.jitted, Compiled):
raise ValueError("Cannot lower a compiled jit function.")
return self.jitted.lower(*args, **kwargs)
def trace(self, *args, **kwargs) -> Traced:
if isinstance(self.jitted, (Traced, Compiled)):
raise TypeError(f"Unsupported type: {type(self.jitted)}.")
return self.jitted.trace(*args, **kwargs)
def name(self):
if self.fun_name is not None:
return self.fun_name
if isinstance(self.jitted, Wrapped):
return getattr(self.jitted._fun, "__name__", str(self.jitted._fun))
raise TypeError(f"Unsupported type: {type(self.jitted)}.")
def __call__(self, *args, **kwargs):
return self.jitted(*args, **kwargs)
View on GitHub (pinned to 24c60942c5)
Solutions
- Create a fresh Wrapped from the original jit function before tracing again
- Skip trace() when isinstance(wrapped.jitted, (Traced, Compiled)) and use the artifact directly
Example fix
# before
traced = wrapped.trace(*args) # already Traced/Compiled
# after
if isinstance(wrapped.jitted, (Traced, Compiled)):
traced = wrapped.jitted # reuse
else:
traced = wrapped.trace(*args) Defensive patterns
Strategy: type-guard
Validate before calling
from phoenix.xrex.utils.aot import Traced, Compiled
if isinstance(wrapped.jitted, (Traced, Compiled)):
traced = wrapped.jitted # reuse
else:
traced = wrapped.trace(*args) Type guard
def is_traceable(wrapped) -> bool:
from phoenix.xrex.utils.aot import Traced, Compiled
return not isinstance(wrapped.jitted, (Traced, Compiled)) Prevention
- Trace once per function; cache the Traced artifact
- Guard pipeline entry points with isinstance checks
- Write pipeline code as explicit stages with type checks between them
When it happens
Trigger: Calling trace() on a Wrapped whose jitted field is a Traced (from a previous trace call) or Compiled (from cache load) object.
Common situations: Re-running a trace/compile pipeline on cached results; loops that call trace multiple times over the same wrapper.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- `axis` should be an int, slice or iterable of ints.
- Cannot remap XLA compile options device assignment: assignme
- Compilation does not support serialization
- execution_devices must be a list of xc.Device. Got: {executi
- AOT is not implemented for non-XLA lowerings.
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/654be717531c0cea.
Report an issue: GitHub.