langchain-ai/langgraph · error · TypeError

Expected a Runnable, callable or dict.Instead got an…

Error message

Expected a Runnable, callable or dict.Instead got an unsupported type: {type(thing)}

What it means

coerce_to_runnable converts nodes/edges into Runnable objects; if the input is not a Runnable, generator function, sync/async callable, or dict of branches, the coercion is impossible and a TypeError naming the actual type is raised.

Solutions

  1. Pass a Runnable, a (sync or async) callable, a generator function, or a dict for conditional edges.
  2. Check for typos like passing a class instead of an instance, or None from a failed factory.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at libs/langgraph/langgraph/_internal/_runnable.py:578 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26). Data as JSON: /api/errors/048701fb774b609b. Report an issue: GitHub.

Appendix: source

Thrown at libs/langgraph/langgraph/_internal/_runnable.py:578

    """
    if isinstance(thing, Runnable):
        return thing
    elif is_async_generator(thing) or inspect.isgeneratorfunction(thing):
        return RunnableLambda(thing, name=name)
    elif callable(thing):
        if is_async_callable(thing):
            return RunnableCallable(None, thing, name=name, trace=trace)
        else:
            return RunnableCallable(
                thing,
                wraps(thing)(partial(run_in_executor, None, thing)),  # type: ignore[arg-type]
                name=name,
                trace=trace,
            )
    elif isinstance(thing, dict):
        return RunnableParallel(thing)
    else:
        raise TypeError(
            f"Expected a Runnable, callable or dict."
            f"Instead got an unsupported type: {type(thing)}"
        )


class RunnableSeq(Runnable):
    """Sequence of `Runnable`, where the output of each is the input of the next.

    `RunnableSeq` is a simpler version of `RunnableSequence` that is internal to
    LangGraph.
    """

    def __init__(
        self,
        *steps: RunnableLike,
        name: str | None = None,
        trace_inputs: Callable[[Any], Any] | None = None,
        trace_outputs: Callable[[Any], Any] | None = None,

View on GitHub (pinned to 38031739e5)