{"record":{"id":"bf79cb591bf9da3c","repo":"langchain-ai/langgraph","slug":"tee-requires-n-1","errorCode":null,"errorMessage":"tee() requires n >= 1","messagePattern":"tee\\(\\) requires n >= 1","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/stream/stream_channel.py","lineNumber":265,"sourceCode":"\n        Each branch has its own buffer; items pulled from the\n        underlying cursor are copied into every branch. Branches are\n        naturally bounded by caller pace since the sync pump is\n        caller-driven.\n\n        Args:\n            n: Number of branches to create. Must be >= 1.\n\n        Returns:\n            A tuple of `n` iterators over the same underlying stream.\n\n        Raises:\n            TypeError: If the channel is unbound or bound to async mode.\n            RuntimeError: If the channel already has a subscriber.\n            ValueError: If `n` < 1.\n        \"\"\"\n        if n < 1:\n            raise ValueError(\"tee() requires n >= 1\")\n        source = self.__iter__()\n        buffers: list[deque[T]] = [deque() for _ in range(n)]\n        exhausted = [False]\n\n        def branch(i: int) -> Iterator[T]:\n            buf = buffers[i]\n            while True:\n                if buf:\n                    yield buf.popleft()\n                elif exhausted[0]:\n                    return\n                else:\n                    try:\n                        item = next(source)\n                    except StopIteration:\n                        exhausted[0] = True\n                        return\n                    for b in buffers:","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/stream/stream_channel.py#L247-L283","documentation":"Error \"tee() requires n >= 1\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/langgraph/langgraph/stream/stream_channel.py:265 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"}