{"record":{"id":"32505e7b1462beaa","repo":"langchain-ai/langgraph","slug":"ambiguous-update-specify-as-node","errorCode":null,"errorMessage":"Ambiguous update, specify as_node","messagePattern":"Ambiguous update, specify as_node","errorType":"exception","errorClass":"InvalidUpdateError","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/pregel/main.py","lineNumber":1935,"sourceCode":"                        isinstance(self.input_channels, str)\n                        and self.input_channels in self.nodes\n                    ):\n                        as_node = self.input_channels\n                elif as_node is None:\n                    last_seen_by_node = sorted(\n                        (v, n)\n                        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:","sourceCodeStart":1917,"sourceCodeEnd":1953,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/pregel/main.py#L1917-L1953","documentation":"Raised by Pregel.update_state when as_node is not given and the checkpoint's version history shows multiple nodes wrote state at the same step, so the attribution target is ambiguous. Replay needs to know which node's writers to apply.","triggerScenarios":"Thrown at libs/langgraph/langgraph/pregel/main.py:1935 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass as_node explicitly, e.g. update_state(config, values, as_node='my_node')","Replay from a checkpoint where only one node wrote"],"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"}