langchain-ai/langgraph · error · ValueError

Unsupported schema type

Error message

Unsupported schema type: {type(schema)}. Expected BaseModel or BaseModelV1.

What it means

ValidationNode._func guard: the schema registered for the called tool name is neither a pydantic v2 BaseModel nor a BaseModelV1 subclass. Argument validation branches on the schema flavor (model_validate vs validate), and an exotic schema type cannot be handled.

Solutions

  1. Register only pydantic BaseModel (v2) or BaseModelV1 schemas with ValidationNode
  2. Rebuild the tool's args_schema as a proper pydantic model class
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at libs/prebuilt/langgraph/prebuilt/tool_validator.py:200 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/3ef26170cfa893ff. Report an issue: GitHub.

Appendix: source

Thrown at libs/prebuilt/langgraph/prebuilt/tool_validator.py:200

        return output_type, message

    def _func(
        self, input: list[AnyMessage] | dict[str, Any], config: RunnableConfig
    ) -> Any:
        """Validate and run tool calls synchronously."""
        output_type, message = self._get_message(input)

        def run_one(call: ToolCall) -> ToolMessage:
            schema = self.schemas_by_name[call["name"]]
            try:
                if issubclass(schema, BaseModel):
                    output = schema.model_validate(call["args"])
                    content = output.model_dump_json()
                elif issubclass(schema, BaseModelV1):
                    output = schema.validate(call["args"])
                    content = output.json()
                else:
                    raise ValueError(
                        f"Unsupported schema type: {type(schema)}. Expected BaseModel or BaseModelV1."
                    )
                return ToolMessage(
                    content=content,
                    name=call["name"],
                    tool_call_id=cast(str, call["id"]),
                )
            except (ValidationError, ValidationErrorV1) as e:
                return ToolMessage(
                    content=self._format_error(e, call, schema),
                    name=call["name"],
                    tool_call_id=cast(str, call["id"]),
                    additional_kwargs={"is_error": True},
                )

        with get_executor_for_config(config) as executor:
            outputs = [*executor.map(run_one, message.tool_calls)]
            if output_type == "list":

View on GitHub (pinned to 38031739e5)