{"record":{"id":"f3d4a1bb1d70d028","repo":"langchain-ai/langgraph","slug":"invalid-state-schema-schema-expected-a-type-or","errorCode":null,"errorMessage":"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","messagePattern":"Invalid state_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","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/graph/state.py","lineNumber":117,"sourceCode":"_DEFAULT_ERROR_HANDLER_NODE = \"__default_error_handler__\"\n\n\n@dataclass(slots=True)\nclass _NodeDefaults:\n    \"\"\"Default node policies applied to every node at compile time.\"\"\"\n\n    retry_policy: RetryPolicy | Sequence[RetryPolicy] | None = None\n    cache_policy: CachePolicy | None = None\n    error_handler: StateNode[Any, Any] | None = None\n    timeout: TimeoutPolicy | None = None\n\n\ndef _warn_invalid_state_schema(schema: type[Any] | Any) -> None:\n    if isinstance(schema, type):\n        return\n    if typing.get_args(schema):\n        return\n    warnings.warn(\n        f\"Invalid state_schema: {schema}. Expected a type or Annotated[type, reducer]. \"\n        \"Please provide a valid schema to ensure correct updates.\\n\"\n        \" See: https://langchain-ai.github.io/langgraph/reference/graphs/#stategraph\"\n    )\n\n\ndef _get_node_name(node: StateNode[Any, ContextT]) -> str:\n    try:\n        return getattr(node, \"__name__\", node.__class__.__name__)\n    except AttributeError:\n        raise TypeError(f\"Unsupported node type: {type(node)}\")\n\n\nclass StateGraph(Generic[StateT, ContextT, InputT, OutputT]):\n    \"\"\"A graph whose nodes communicate by reading and writing to a shared state.\n\n    The signature of each node is `State -> Partial<State>`.\n","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/graph/state.py#L99-L135","documentation":"Error \"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\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/langgraph/langgraph/graph/state.py:117 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}