langchain-ai/langgraph · error · ValueError
Invalid version . Supported versions are 'v1' and 'v2'.
Error message
Invalid version {version}. Supported versions are 'v1' and 'v2'. What it means
Guard in create_react_agent rejecting any `version` value other than the literals 'v1' or 'v2'. Version selects which prompt/agent template is built; an unrecognized string (or a typo) fails fast here rather than producing an agent with unknown behavior.
Solutions
- Pass version="v1" or version="v2" (or omit it to use the default)
- If migrating, consult the create_react_agent docs for what changed between v1 and v2
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py:534 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/689e3f61e2da1b10.
Report an issue: GitHub.
Appendix: source
Thrown at libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py:534
"""
if (
config_schema := deprecated_kwargs.pop("config_schema", MISSING)
) is not MISSING:
warnings.warn(
"`config_schema` is deprecated and will be removed. Please use `context_schema` instead.",
category=LangGraphDeprecatedSinceV10,
)
if context_schema is None:
context_schema = config_schema
if len(deprecated_kwargs) > 0:
raise TypeError(
f"create_react_agent() got unexpected keyword arguments: {deprecated_kwargs}"
)
if version not in ("v1", "v2"):
raise ValueError(
f"Invalid version {version}. Supported versions are 'v1' and 'v2'."
)
if state_schema is not None:
required_keys = {"messages", "remaining_steps"}
if response_format is not None:
required_keys.add("structured_response")
schema_keys = set(get_type_hints(state_schema))
if missing_keys := required_keys - set(schema_keys):
raise ValueError(f"Missing required key(s) {missing_keys} in state_schema")
if state_schema is None:
state_schema = (
AgentStateWithStructuredResponse
if response_format is not None
else AgentState
)View on GitHub (pinned to 38031739e5)