{"record":{"id":"ef3dc0851a8f3889","repo":"langchain-ai/langgraph","slug":"cannot-inject-store-into-tools-with-injectedstore","errorCode":null,"errorMessage":"Cannot inject store into tools with InjectedStore annotations - please compile your graph with a store.","messagePattern":"Cannot inject store into tools with InjectedStore annotations - please compile your graph with a store\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/prebuilt/langgraph/prebuilt/tool_node.py","lineNumber":1414,"sourceCode":"                    elif tool_arg not in injected._optional_state_args:\n                        raise KeyError(state_field)\n            else:\n                for tool_arg, state_field in injected.state.items():\n                    if not state_field:\n                        injected_args[tool_arg] = state\n                    elif hasattr(state, state_field):\n                        injected_args[tool_arg] = getattr(state, state_field)\n                    elif tool_arg not in injected._optional_state_args:\n                        raise AttributeError(state_field)\n\n        # Inject store\n        if injected.store:\n            if tool_runtime.store is None:\n                msg = (\n                    \"Cannot inject store into tools with InjectedStore annotations - \"\n                    \"please compile your graph with a store.\"\n                )\n                raise ValueError(msg)\n            injected_args[injected.store] = tool_runtime.store\n\n        # Inject runtime\n        if injected.runtime:\n            injected_args[injected.runtime] = tool_runtime\n\n        # Strip any caller-supplied values for injected args, then add\n        # back only trusted values. This prevents an LLM from forging\n        # hidden InjectedToolArg fields via ToolCall.args.\n        stripped_args = {\n            k: v\n            for k, v in tool_call_copy[\"args\"].items()\n            if k not in injected.all_injected_keys\n        }\n        tool_call_copy[\"args\"] = {**stripped_args, **injected_args}\n        return tool_call_copy\n\n    def _normalize_tool_response(","sourceCodeStart":1396,"sourceCodeEnd":1432,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/prebuilt/langgraph/prebuilt/tool_node.py#L1396-L1432","documentation":"Error \"Cannot inject store into tools with InjectedStore annotations - please compile your graph with a store.\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/prebuilt/langgraph/prebuilt/tool_node.py:1414 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}