langchain-ai/langgraph · error · ValueError

Cannot inject store into tools with InjectedStore…

Error message

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

What it means

Raised by ToolNode when a tool declares an InjectedStore argument but no store was provided to the graph. The store cannot be injected into the tool call, so execution would fail; the node refuses eagerly. Compile or invoke the graph with a store (or remove the InjectedStore annotation).

Solutions

  1. Compile the graph with a store: `graph.compile(checkpointer=..., store=InMemoryStore())`
  2. Or pass the store when running: `graph.invoke(inputs, config={"configurable": {...}})` with a store bound at compile time
  3. Remove the InjectedStore annotation if the tool doesn't need persistence
Defensive patterns

Strategy: validation

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.

Appendix: 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)