langchain-ai/langgraph · error · InvalidUpdateError
as_node is required when applying multiple updates
Error message
as_node is required when applying multiple updates
What it means
Raised when multiple updates are applied but none specifies as_node and the checkpoint history is ambiguous (several nodes wrote with equal versions, so no single author can be inferred). The engine refuses to guess which node the updates belong to. Pass an explicit as_node for each update.
Solutions
- Provide as_node for every update in the list
- Apply ambiguous updates one at a time so as_node can be inferred
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at libs/langgraph/langgraph/pregel/main.py:1942 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/15bec5ed8d49f29c.
Report an issue: GitHub.
Appendix: source
Thrown at libs/langgraph/langgraph/pregel/main.py:1942
for n, seen in checkpoint["versions_seen"].items()
if n in self.nodes
for v in seen.values()
)
# if two nodes updated the state at the same time, it's ambiguous
if last_seen_by_node:
if len(last_seen_by_node) == 1:
as_node = last_seen_by_node[0][1]
elif last_seen_by_node[-1][0] != last_seen_by_node[-2][0]:
as_node = last_seen_by_node[-1][1]
if as_node is None:
raise InvalidUpdateError("Ambiguous update, specify as_node")
if as_node not in self.nodes:
raise InvalidUpdateError(f"Node {as_node} does not exist")
valid_updates.append((as_node, values, task_id))
else:
for values, as_node, task_id in updates:
if as_node is None:
raise InvalidUpdateError(
"as_node is required when applying multiple updates"
)
if as_node not in self.nodes:
raise InvalidUpdateError(f"Node {as_node} does not exist")
valid_updates.append((as_node, values, task_id))
run_tasks: list[PregelTaskWrites] = []
run_task_ids: list[str] = []
for as_node, values, provided_task_id in valid_updates:
# create task to run all writers of the chosen node
writers = self.nodes[as_node].flat_writers
if not writers:
raise InvalidUpdateError(f"Node {as_node} has no writers")
writes: deque[tuple[str, Any]] = deque()
task = PregelTaskWrites((), as_node, writes, [INTERRUPT])
# get the task ids that were prepared for this nodeView on GitHub (pinned to 38031739e5)