langchain-ai/langgraph · error · RuntimeError

StreamChannel already has a subscriber; use .atee(n) for fan

Error message

StreamChannel already has a subscriber; use .atee(n) for fan-out.

What it means

Error "StreamChannel already has a subscriber; use .atee(n) for fan-out." thrown in langchain-ai/langgraph.

Source

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

    def __aiter__(self) -> AsyncIterator[T]:
        """Subscribe and return an async cursor. Can be called only once.

        Raises:
            TypeError: If the channel is unbound or bound to sync mode.
            RuntimeError: If the channel already has a subscriber.
        """
        if self._is_async is None:
            raise TypeError(
                "StreamChannel has not been bound yet. "
                "Register the transformer with a StreamMux first."
            )
        if not self._is_async:
            raise TypeError(
                "This StreamChannel is bound to sync mode — use 'for' instead."
            )
        if self._subscribed:
            raise RuntimeError(
                "StreamChannel already has a subscriber; use .atee(n) for fan-out."
            )
        self._subscribed = True
        return self._async_cursor()

    async def _async_cursor(self) -> AsyncIterator[T]:
        while True:
            if self._items:
                _stamp, item = self._items.popleft()
                yield item
            elif self._closed:
                if self._error is not None:
                    raise self._error
                return
            elif self._arequest_more is not None:
                if not await self._arequest_more():
                    if not self._items and not self._closed:
                        return

View on GitHub (pinned to 38031739e5)

When it happens

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