{"record":{"id":"4873124edfea3c6c","repo":"langchain-ai/langgraph","slug":"state-field","errorCode":null,"errorMessage":"{state_field}","messagePattern":"\\{state_field\\}","errorType":"exception","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"libs/prebuilt/langgraph/prebuilt/tool_node.py","lineNumber":1397,"sourceCode":"                        f\"Invalid input to ToolNode. Tool {tool_call['name']} requires \"\n                        f\"graph state dict as input.\"\n                    )\n                    if any(state_field for state_field in injected.state.values()):\n                        required_fields_str = \", \".join(f for f in required_fields if f)\n                        err_msg += (\n                            f\" State should contain fields {required_fields_str}.\"\n                        )\n                    raise ValueError(err_msg)\n\n            # Extract state values\n            if isinstance(state, dict):\n                for tool_arg, state_field in injected.state.items():\n                    if not state_field:\n                        injected_args[tool_arg] = state\n                    elif state_field in state:\n                        injected_args[tool_arg] = state[state_field]\n                    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","sourceCodeStart":1379,"sourceCodeEnd":1415,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/prebuilt/langgraph/prebuilt/tool_node.py#L1379-L1415","documentation":"Error \"{state_field}\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/prebuilt/langgraph/prebuilt/tool_node.py:1397 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"}