{"record":{"id":"196414f3d616528d","repo":"langchain-ai/langgraph","slug":"branch-did-not-return-a-valid-destination","errorCode":null,"errorMessage":"Branch did not return a valid destination","messagePattern":"Branch did not return a valid destination","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/graph/_branch.py","lineNumber":208,"sourceCode":"        return self._finish(writer, input, result, config)\n\n    def _finish(\n        self,\n        writer: _Writer,\n        input: Any,\n        result: Any,\n        config: RunnableConfig,\n    ) -> Runnable | Any:\n        if not isinstance(result, (list, tuple)):\n            result = [result]\n        if self.ends:\n            destinations: Sequence[Send | str] = [\n                r if isinstance(r, Send) else self.ends[r] for r in result\n            ]\n        else:\n            destinations = cast(Sequence[Send | str], result)\n        if any(dest is None or dest == START for dest in destinations):\n            raise ValueError(\"Branch did not return a valid destination\")\n        if any(p.node == END for p in destinations if isinstance(p, Send)):\n            raise InvalidUpdateError(\"Cannot send a packet to the END node\")\n        entries = writer(destinations, False)\n        if not entries:\n            return input\n        else:\n            need_passthrough = False\n            for e in entries:\n                if isinstance(e, ChannelWriteEntry):\n                    if e.value is PASSTHROUGH:\n                        need_passthrough = True\n                        break\n            if need_passthrough:\n                return ChannelWrite(entries)\n            else:\n                ChannelWrite.do_write(config, entries)\n                return input\n","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/graph/_branch.py#L190-L226","documentation":"Error \"Branch did not return a valid destination\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/langgraph/langgraph/graph/_branch.py:208 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"}