{"record":{"id":"15bec5ed8d49f29c","repo":"langchain-ai/langgraph","slug":"as-node-is-required-when-applying-multiple-updates","errorCode":null,"errorMessage":"as_node is required when applying multiple updates","messagePattern":"as_node is required when applying multiple updates","errorType":"exception","errorClass":"InvalidUpdateError","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/pregel/main.py","lineNumber":1942,"sourceCode":"                        for n, seen in checkpoint[\"versions_seen\"].items()\n                        if n in self.nodes\n                        for v in seen.values()\n                    )\n                    # if two nodes updated the state at the same time, it's ambiguous\n                    if last_seen_by_node:\n                        if len(last_seen_by_node) == 1:\n                            as_node = last_seen_by_node[0][1]\n                        elif last_seen_by_node[-1][0] != last_seen_by_node[-2][0]:\n                            as_node = last_seen_by_node[-1][1]\n                if as_node is None:\n                    raise InvalidUpdateError(\"Ambiguous update, specify as_node\")\n                if as_node not in self.nodes:\n                    raise InvalidUpdateError(f\"Node {as_node} does not exist\")\n                valid_updates.append((as_node, values, task_id))\n            else:\n                for values, as_node, task_id in updates:\n                    if as_node is None:\n                        raise InvalidUpdateError(\n                            \"as_node is required when applying multiple updates\"\n                        )\n                    if as_node not in self.nodes:\n                        raise InvalidUpdateError(f\"Node {as_node} does not exist\")\n\n                    valid_updates.append((as_node, values, task_id))\n\n            run_tasks: list[PregelTaskWrites] = []\n            run_task_ids: list[str] = []\n\n            for as_node, values, provided_task_id in valid_updates:\n                # create task to run all writers of the chosen node\n                writers = self.nodes[as_node].flat_writers\n                if not writers:\n                    raise InvalidUpdateError(f\"Node {as_node} has no writers\")\n                writes: deque[tuple[str, Any]] = deque()\n                task = PregelTaskWrites((), as_node, writes, [INTERRUPT])\n                # get the task ids that were prepared for this node","sourceCodeStart":1924,"sourceCodeEnd":1960,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/pregel/main.py#L1924-L1960","documentation":"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.","triggerScenarios":"Thrown at libs/langgraph/langgraph/pregel/main.py:1942 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide as_node for every update in the list","Apply ambiguous updates one at a time so as_node can be inferred"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","contentChangedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}