langchain-ai/langgraph · error · TypeError

create_react_agent() got unexpected keyword arguments

Error message

create_react_agent() got unexpected keyword arguments: {deprecated_kwargs}

What it means

Raised by create_react_agent when leftover keyword arguments remain in `deprecated_kwargs` after known deprecations (like config_schema) are popped. It means the caller passed arguments that no longer exist in the current signature of create_react_agent.

Solutions

  1. Check the current create_react_agent signature and rename/remove the offending kwargs (e.g. use `context_schema` instead of `config_schema`)
  2. Upgrade-guided migration: pass only supported parameters and move custom logic into `pre_model_hook`/`post_model_hook` as appropriate
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py:529 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/27815eb0915f2039. Report an issue: GitHub.

Appendix: source

Thrown at libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py:529

        )
        inputs = {"messages": [{"role": "user", "content": "what is the weather in sf"}]}
        for chunk in graph.stream(inputs, stream_mode="updates"):
            print(chunk)
        ```
    """
    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:

View on GitHub (pinned to 38031739e5)