{"record":{"id":"94c70857ad7974a2","repo":"langchain-ai/langgraph","slug":"invalid-context-schema-type-context-schema-mus","errorCode":null,"errorMessage":"Invalid context schema type: {context_schema}. Must be a BaseModel, TypedDict or dataclass.","messagePattern":"Invalid context schema type: (.+?)\\. Must be a BaseModel, TypedDict or dataclass\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/pregel/main.py","lineNumber":1003,"sourceCode":"            category=LangGraphDeprecatedSinceV10,\n            stacklevel=2,\n        )\n\n        with warnings.catch_warnings():\n            warnings.filterwarnings(\"ignore\", category=LangGraphDeprecatedSinceV10)\n            schema = self.config_schema(include=include)\n        return schema.model_json_schema()\n\n    def get_context_jsonschema(self) -> dict[str, Any] | None:\n        if (context_schema := self.context_schema) is None:\n            return None\n\n        if isclass(context_schema) and issubclass(context_schema, BaseModel):\n            return context_schema.model_json_schema()\n        elif is_typeddict(context_schema) or is_dataclass(context_schema):\n            return TypeAdapter(context_schema).json_schema()\n        else:\n            raise ValueError(\n                f\"Invalid context schema type: {context_schema}. Must be a BaseModel, TypedDict or dataclass.\"\n            )\n\n    @property\n    def InputType(self) -> Any:\n        if isinstance(self.input_channels, str):\n            channel = self.channels[self.input_channels]\n            if isinstance(channel, BaseChannel):\n                return channel.UpdateType\n\n    def get_input_schema(self, config: RunnableConfig | None = None) -> type[BaseModel]:\n        config = merge_configs(self.config, config)\n        if isinstance(self.input_channels, str):\n            return super().get_input_schema(config)\n        else:\n            return create_model(\n                self.get_name(\"Input\"),\n                field_definitions={","sourceCodeStart":985,"sourceCodeEnd":1021,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/pregel/main.py#L985-L1021","documentation":"Raised by get_context_jsonschema when the graph's context_schema is not a supported schema type. Only Pydantic BaseModel subclasses, TypedDicts, and dataclasses can be converted to JSON Schema; any other type annotation passed as context_schema fails here. Provide one of the supported schema types.","triggerScenarios":"Thrown at libs/langgraph/langgraph/pregel/main.py:1003 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Define context_schema as a pydantic BaseModel, TypedDict, or dataclass","Skip JSON-schema generation if an arbitrary type must be used"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","contentChangedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}