langchain-ai/langgraph · error · InvalidUpdateError

Cannot send a packet to the END node

Error message

Cannot send a packet to the END node

What it means

Raised by RunnableBranch._finish when a conditional edge resolves to END but the result value is a Send packet rather than the plain END string. Packets cannot be delivered to END because there is no node to receive them.

Solutions

  1. Return END directly instead of Send(...) when routing to the end of the graph
  2. Return a plain node name string for terminal destinations
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at libs/langgraph/langgraph/graph/_branch.py:210 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/9f6f870adcccad7e. Report an issue: GitHub.

Appendix: source

Thrown at libs/langgraph/langgraph/graph/_branch.py:210

    def _finish(
        self,
        writer: _Writer,
        input: Any,
        result: Any,
        config: RunnableConfig,
    ) -> Runnable | Any:
        if not isinstance(result, (list, tuple)):
            result = [result]
        if self.ends:
            destinations: Sequence[Send | str] = [
                r if isinstance(r, Send) else self.ends[r] for r in result
            ]
        else:
            destinations = cast(Sequence[Send | str], result)
        if any(dest is None or dest == START for dest in destinations):
            raise ValueError("Branch did not return a valid destination")
        if any(p.node == END for p in destinations if isinstance(p, Send)):
            raise InvalidUpdateError("Cannot send a packet to the END node")
        entries = writer(destinations, False)
        if not entries:
            return input
        else:
            need_passthrough = False
            for e in entries:
                if isinstance(e, ChannelWriteEntry):
                    if e.value is PASSTHROUGH:
                        need_passthrough = True
                        break
            if need_passthrough:
                return ChannelWrite(entries)
            else:
                ChannelWrite.do_write(config, entries)
                return input

View on GitHub (pinned to 38031739e5)