langchain-ai/langgraph · error · TypeError
Expected a Pydantic model. Got {type(model)}
Error message
Expected a Pydantic model. Got {type(model)} What it means
Error "Expected a Pydantic model. Got {type(model)}" thrown in langchain-ai/langgraph.
Source
Thrown at libs/langgraph/langgraph/_internal/_pydantic.py:51
@overload
def get_fields(model: type[BaseModel]) -> dict[str, FieldInfo]: ...
@overload
def get_fields(model: BaseModel) -> dict[str, FieldInfo]: ...
def get_fields(
model: type[BaseModel] | BaseModel,
) -> dict[str, FieldInfo]:
"""Get the field names of a Pydantic model."""
if hasattr(model, "model_fields"):
return model.model_fields
if hasattr(model, "__fields__"):
return model.__fields__
msg = f"Expected a Pydantic model. Got {type(model)}"
raise TypeError(msg)
_SchemaConfig = ConfigDict(
arbitrary_types_allowed=True, frozen=True, protected_namespaces=()
)
NO_DEFAULT = object()
def _create_root_model(
name: str,
type_: Any,
module_name: str | None = None,
default_: object = NO_DEFAULT,
) -> type[BaseModel]:
"""Create a base class."""
def schema(View on GitHub (pinned to 38031739e5)
When it happens
Trigger: Thrown at libs/langgraph/langgraph/_internal/_pydantic.py:51 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/4cce76d2a578e432.
Report an issue: GitHub.