{"record":{"id":"e55055631b686951","repo":"langchain-ai/langgraph","slug":"tools-can-provide-a-dict-in-command-update-only-wh","errorCode":null,"errorMessage":"Tools can provide a dict in Command.update only when using dict with '{messages_key}' key as ToolNode input, got: {update} for tool '{name}'","messagePattern":"Tools can provide a dict in Command\\.update only when using dict with '(.+?)' key as ToolNode input, got: (.+?) for tool '(.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/prebuilt/langgraph/prebuilt/tool_node.py","lineNumber":1520,"sourceCode":"\n    def _validate_tool_command(\n        self,\n        command: Command,\n        call: ToolCall,\n        input_type: Literal[\"list\", \"dict\", \"tool_calls\"],\n        *,\n        require_terminator: bool = True,\n    ) -> Command:\n        if isinstance(command.update, dict):\n            # input type is dict when ToolNode is invoked with a dict input\n            # (e.g. {\"messages\": [AIMessage(..., tool_calls=[...])]})\n            if input_type not in (\"dict\", \"tool_calls\"):\n                msg = (\n                    \"Tools can provide a dict in Command.update only when using dict \"\n                    f\"with '{self._messages_key}' key as ToolNode input, \"\n                    f\"got: {command.update} for tool '{call['name']}'\"\n                )\n                raise ValueError(msg)\n\n            updated_command = deepcopy(command)\n            state_update = cast(\"dict[str, Any]\", updated_command.update) or {}\n            messages_update = state_update.get(self._messages_key, [])\n        elif isinstance(command.update, list):\n            # Input type is list when ToolNode is invoked with a list input\n            # (e.g. [AIMessage(..., tool_calls=[...])])\n            if input_type != \"list\":\n                msg = (\n                    \"Tools can provide a list of messages in Command.update \"\n                    \"only when using list of messages as ToolNode input, \"\n                    f\"got: {command.update} for tool '{call['name']}'\"\n                )\n                raise ValueError(msg)\n\n            updated_command = deepcopy(command)\n            messages_update = updated_command.update\n        else:","sourceCodeStart":1502,"sourceCodeEnd":1538,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/prebuilt/langgraph/prebuilt/tool_node.py#L1502-L1538","documentation":"Error \"Tools can provide a dict in Command.update only when using dict with '{messages_key}' key as ToolNode input, got: {update} for tool '{name}'\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/prebuilt/langgraph/prebuilt/tool_node.py:1520 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"}