langchain-ai/langgraph · error · ValueError
Tools can provide a list of messages in Command.update only…
Error message
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']}' What it means
Shape check in _validate_tool_command: the tool returned a Command whose update is a list of messages, but ToolNode was invoked with a dict state input. List updates are only valid when the node itself was given a list of messages; with dict input, updates must be keyed dicts.
Solutions
- Return a dict update keyed by the messages key: `Command(update={"messages": [ToolMessage(...)]})`
- Or invoke ToolNode with a plain list of messages so list updates are accepted
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at libs/prebuilt/langgraph/prebuilt/tool_node.py:1534 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26).
Data as JSON: /api/errors/41ed682c5779b3bf.
Report an issue: GitHub.
Appendix: source
Thrown at libs/prebuilt/langgraph/prebuilt/tool_node.py:1534
"Tools can provide a dict in Command.update only when using dict "
f"with '{self._messages_key}' key as ToolNode input, "
f"got: {command.update} for tool '{call['name']}'"
)
raise ValueError(msg)
updated_command = deepcopy(command)
state_update = cast("dict[str, Any]", updated_command.update) or {}
messages_update = state_update.get(self._messages_key, [])
elif isinstance(command.update, list):
# Input type is list when ToolNode is invoked with a list input
# (e.g. [AIMessage(..., tool_calls=[...])])
if input_type != "list":
msg = (
"Tools can provide a list of messages in Command.update "
"only when using list of messages as ToolNode input, "
f"got: {command.update} for tool '{call['name']}'"
)
raise ValueError(msg)
updated_command = deepcopy(command)
messages_update = updated_command.update
else:
return command
# convert to message objects if updates are in a dict format
messages_update = convert_to_messages(messages_update)
# no validation needed if all messages are being removed
if messages_update == [RemoveMessage(id=REMOVE_ALL_MESSAGES)]:
return updated_command
has_matching_tool_message = False
for message in messages_update:
if not isinstance(message, ToolMessage):
continue
View on GitHub (pinned to 38031739e5)