langchain-ai/langgraph · error · ValueError

Cannot inject store into tools with InjectedStore annotation

Error message

Cannot inject store into tools with InjectedStore annotations - please compile your graph with a store.

What it means

Error "Cannot inject store into tools with InjectedStore annotations - please compile your graph with a store." thrown in langchain-ai/langgraph.

Source

Thrown at libs/prebuilt/langgraph/prebuilt/tool_node.py:1414

                    elif tool_arg not in injected._optional_state_args:
                        raise KeyError(state_field)
            else:
                for tool_arg, state_field in injected.state.items():
                    if not state_field:
                        injected_args[tool_arg] = state
                    elif hasattr(state, state_field):
                        injected_args[tool_arg] = getattr(state, state_field)
                    elif tool_arg not in injected._optional_state_args:
                        raise AttributeError(state_field)

        # Inject store
        if injected.store:
            if tool_runtime.store is None:
                msg = (
                    "Cannot inject store into tools with InjectedStore annotations - "
                    "please compile your graph with a store."
                )
                raise ValueError(msg)
            injected_args[injected.store] = tool_runtime.store

        # Inject runtime
        if injected.runtime:
            injected_args[injected.runtime] = tool_runtime

        # Strip any caller-supplied values for injected args, then add
        # back only trusted values. This prevents an LLM from forging
        # hidden InjectedToolArg fields via ToolCall.args.
        stripped_args = {
            k: v
            for k, v in tool_call_copy["args"].items()
            if k not in injected.all_injected_keys
        }
        tool_call_copy["args"] = {**stripped_args, **injected_args}
        return tool_call_copy

    def _normalize_tool_response(

View on GitHub (pinned to 38031739e5)

When it happens

Trigger: Thrown at libs/prebuilt/langgraph/prebuilt/tool_node.py:1414 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/ef3dc0851a8f3889. Report an issue: GitHub.