{"record":{"id":"7c89d04c0282e013","repo":"langchain-ai/langgraph","slug":"unsupported-input-to-validationnode-expected-base","errorCode":null,"errorMessage":"Unsupported input to ValidationNode. Expected BaseModel, tool or function. Got: {type(schema)}.","messagePattern":"Unsupported input to ValidationNode\\. Expected BaseModel, tool or function\\. Got: (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/prebuilt/langgraph/prebuilt/tool_validator.py","lineNumber":164,"sourceCode":"                        f\"Tool {schema.name} does not have an args_schema defined.\"\n                    )\n                elif not isinstance(\n                    schema.args_schema, type\n                ) or not is_basemodel_subclass(schema.args_schema):\n                    raise ValueError(\n                        \"Validation node only works with tools that have a pydantic BaseModel args_schema. \"\n                        f\"Got {schema.name} with args_schema: {schema.args_schema}.\"\n                    )\n                self.schemas_by_name[schema.name] = schema.args_schema\n            elif isinstance(schema, type) and issubclass(\n                schema, (BaseModel, BaseModelV1)\n            ):\n                self.schemas_by_name[schema.__name__] = cast(type[BaseModel], schema)\n            elif callable(schema):\n                base_model = create_schema_from_function(\"Validation\", schema)\n                self.schemas_by_name[schema.__name__] = base_model\n            else:\n                raise ValueError(\n                    f\"Unsupported input to ValidationNode. Expected BaseModel, tool or function. Got: {type(schema)}.\"\n                )\n\n    def _get_message(\n        self, input: list[AnyMessage] | dict[str, Any]\n    ) -> tuple[str, AIMessage]:\n        \"\"\"Extract the last AIMessage from the input.\"\"\"\n        if isinstance(input, list):\n            output_type = \"list\"\n            messages: list = input\n        elif messages := input.get(\"messages\", []):\n            output_type = \"dict\"\n        else:\n            raise ValueError(\"No message found in input\")\n        message: AnyMessage = messages[-1]\n        if not isinstance(message, AIMessage):\n            raise ValueError(\"Last message is not an AIMessage\")\n        return output_type, message","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/prebuilt/langgraph/prebuilt/tool_validator.py#L146-L182","documentation":"Error \"Unsupported input to ValidationNode. Expected BaseModel, tool or function. Got: {type(schema)}.\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/prebuilt/langgraph/prebuilt/tool_validator.py:164 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"}