langchain-ai/langgraph · error · ValueError

StreamChannel maxlen must be a positive int or None

Error message

StreamChannel maxlen must be a positive int or None

What it means

Error "StreamChannel maxlen must be a positive int or None" thrown in langchain-ai/langgraph.

Source

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

        """Initialize the channel.

        Args:
            name: Optional protocol channel name. When set, the
                StreamMux wires every `push()` to also inject a
                `ProtocolEvent` into the main event stream. Surfaced
                on the wire as `custom:<name>` for user-defined
                transformers, or as `<name>` for channels owned by a
                native transformer (`_native = True`). When `None`,
                the channel is local-only.
            maxlen: Accepted for forward compatibility; currently
                unused. The caller-driven pump bounds memory naturally
                for single-consumer use.

        Raises:
            ValueError: If `maxlen` is not a positive integer or `None`.
        """
        if maxlen is not None and maxlen <= 0:
            raise ValueError("StreamChannel maxlen must be a positive int or None")
        self.name = name
        self._items: deque[tuple[int, T]] = deque()
        self._maxlen: int | None = maxlen
        self._closed = False
        self._error: BaseException | None = None

        self._is_async: bool | None = None

        self._subscribed = False

        self._request_more: Callable[[], bool] | None = None
        self._arequest_more: Callable[[], Awaitable[bool]] | None = None

        self._wire_fn: Callable[[T], None] | None = None
        self._mux: StreamMux | None = None

    # ------------------------------------------------------------------
    # Binding

View on GitHub (pinned to 38031739e5)

When it happens

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