{"record":{"id":"41ed682c5779b3bf","repo":"langchain-ai/langgraph","slug":"tools-can-provide-a-list-of-messages-in-command-up","errorCode":null,"errorMessage":"Tools can provide a list of messages in Command.update only when using list of messages as ToolNode input, got: {command.update} for tool '{call['name']}'","messagePattern":"Tools can provide a list of messages in Command\\.update only when using list of messages as ToolNode input, got: (.+?) for tool '(.+?)'","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/prebuilt/langgraph/prebuilt/tool_node.py","lineNumber":1534,"sourceCode":"                    \"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:\n            return command\n\n        # convert to message objects if updates are in a dict format\n        messages_update = convert_to_messages(messages_update)\n\n        # no validation needed if all messages are being removed\n        if messages_update == [RemoveMessage(id=REMOVE_ALL_MESSAGES)]:\n            return updated_command\n\n        has_matching_tool_message = False\n        for message in messages_update:\n            if not isinstance(message, ToolMessage):\n                continue\n","sourceCodeStart":1516,"sourceCodeEnd":1552,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/prebuilt/langgraph/prebuilt/tool_node.py#L1516-L1552","documentation":"Error \"Tools can provide a list of messages in Command.update only when using list of messages as ToolNode input, got: {command.update} for tool '{call['name']}'\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/prebuilt/langgraph/prebuilt/tool_node.py:1534 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"}