{"record":{"id":"b124d5e53afd81dd","repo":"langchain-ai/langgraph","slug":"invalid-input-to-toolnode-tool-name-requires-gr","errorCode":null,"errorMessage":"Invalid input to ToolNode. Tool {name} requires graph state dict as input.","messagePattern":"Invalid input to ToolNode\\. Tool (.+?) requires graph state dict as input\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/prebuilt/langgraph/prebuilt/tool_node.py","lineNumber":1387,"sourceCode":"            # Handle list state by converting to dict\n            if isinstance(state, list):\n                required_fields = list(injected.state.values())\n                if (\n                    len(required_fields) == 1\n                    and required_fields[0] == self._messages_key\n                ) or required_fields[0] is None:\n                    state = {self._messages_key: state}\n                else:\n                    err_msg = (\n                        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)","sourceCodeStart":1369,"sourceCodeEnd":1405,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/prebuilt/langgraph/prebuilt/tool_node.py#L1369-L1405","documentation":"Error \"Invalid input to ToolNode. Tool {name} requires graph state dict as input.\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/prebuilt/langgraph/prebuilt/tool_node.py:1387 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"}