langchain-ai/langgraph · error · TypeError
Unsupported node type
Error message
Unsupported node type: {type(node)} What it means
Raised by _get_node_name when a node object exposes neither __name__ nor a usable class __name__ for deriving a node name. It is a generic guard naming the node's actual type; typically a non-function, non-Runnable object was passed as a node.
Solutions
- Pass a plain function, lambda, or Runnable as the node action
- Provide the node name explicitly as the first argument to add_node
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at libs/langgraph/langgraph/graph/state.py:128 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/2a85fcbcf42ce5d9.
Report an issue: GitHub.
Appendix: source
Thrown at libs/langgraph/langgraph/graph/state.py:128
def _warn_invalid_state_schema(schema: type[Any] | Any) -> None:
if isinstance(schema, type):
return
if typing.get_args(schema):
return
warnings.warn(
f"Invalid state_schema: {schema}. Expected a type or Annotated[type, reducer]. "
"Please provide a valid schema to ensure correct updates.\n"
" See: https://langchain-ai.github.io/langgraph/reference/graphs/#stategraph"
)
def _get_node_name(node: StateNode[Any, ContextT]) -> str:
try:
return getattr(node, "__name__", node.__class__.__name__)
except AttributeError:
raise TypeError(f"Unsupported node type: {type(node)}")
class StateGraph(Generic[StateT, ContextT, InputT, OutputT]):
"""A graph whose nodes communicate by reading and writing to a shared state.
The signature of each node is `State -> Partial<State>`.
Each state key can optionally be annotated with a reducer function that
will be used to aggregate the values of that key received from multiple nodes.
The signature of a reducer function is `(Value, Value) -> Value`.
!!! warning
`StateGraph` is a builder class and cannot be used directly for execution.
You must first call `.compile()` to create an executable graph that supports
methods like `invoke()`, `stream()`, `astream()`, and `ainvoke()`. See the
`CompiledStateGraph` documentation for more details.
View on GitHub (pinned to 38031739e5)