langchain-ai/langgraph · error · RuntimeError

Cannot push to a closed StreamChannel

Error message

Cannot push to a closed StreamChannel

What it means

Error "Cannot push to a closed StreamChannel" thrown in langchain-ai/langgraph.

Source

Thrown at libs/langgraph/langgraph/stream/stream_channel.py:136

    # ------------------------------------------------------------------

    def push(self, item: T) -> None:
        """Append an item. Auto-forwards if wired.

        The local buffer append is a no-op when no subscriber is
        registered, but auto-forwarding always fires so wired events
        reach the main event log regardless of subscription state.

        Items are stored as `(stamp, item)` tuples where stamp is a
        monotonic counter from the owning mux. Stamps are stripped by
        the default cursors; raw stamped tuples are visible on `_items`.

        Raises:
            RuntimeError: If the channel is closed (and subscribed).
        """
        if self._subscribed:
            if self._closed:
                raise RuntimeError("Cannot push to a closed StreamChannel")
            stamp = self._mux._next_push_seq() if self._mux is not None else 0
            self._items.append((stamp, item))
        if self._wire_fn is not None:
            self._wire_fn(item)

    def close(self) -> None:
        """Mark the channel as complete."""
        self._closed = True

    def fail(self, err: BaseException) -> None:
        """Mark the channel as errored.

        Args:
            err: The exception to surface to the subscriber.
        """
        self._error = err
        self._closed = True

View on GitHub (pinned to 38031739e5)

When it happens

Trigger: Thrown at libs/langgraph/langgraph/stream/stream_channel.py:136 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/b742df0a32db8ca2. Report an issue: GitHub.