{"record":{"id":"fc41eeb9f4972491","repo":"langchain-ai/langgraph","slug":"streammux-make-child-requires-the-mux-to-be-const","errorCode":null,"errorMessage":"StreamMux._make_child requires the mux to be constructed with `factories=`; pre-built transformers can't be cloned to a new scope.","messagePattern":"StreamMux\\._make_child requires the mux to be constructed with `factories=`; pre-built transformers can't be cloned to a new scope\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/stream/_mux.py","lineNumber":210,"sourceCode":"\n    def _make_child(self, scope: tuple[str, ...]) -> StreamMux:\n        \"\"\"Build a mini-mux with the same factories scoped to `scope`.\n\n        Used by `SubgraphTransformer` to attach a fresh transformer\n        pipeline to each discovered subgraph handle. The child mux\n        inherits the current pump bindings (so cursors on its\n        projection logs drive the root pump), carries the same factory\n        list forward to any grandchild subgraphs, and does not assign\n        `seq` numbers so forwarded events can be shared without\n        mutating their envelope.\n\n        Raises:\n            RuntimeError: If the mux was not constructed with\n                `factories=`. Mini-muxes require factories so each scope\n                gets its own fresh transformer instances.\n        \"\"\"\n        if self._factories is None:\n            raise RuntimeError(\n                \"StreamMux._make_child requires the mux to be constructed \"\n                \"with `factories=`; pre-built transformers can't be \"\n                \"cloned to a new scope.\"\n            )\n        child = StreamMux(\n            factories=self._factories,\n            is_async=self.is_async,\n            scope=scope,\n            _assign_seq=False,\n        )\n        if self._pump_fn is not None:\n            child.bind_pump(self._pump_fn)\n        if self._apump_fn is not None:\n            child.bind_apump(self._apump_fn)\n        return child\n\n    def _register(self, transformer: StreamTransformer) -> None:\n        \"\"\"Register a single transformer.","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/stream/_mux.py#L192-L228","documentation":"Raised by StreamMux._make_child when the mux was built from pre-built transformer instances rather than factories. Child muxes (for subgraph scopes) are created by calling factories with the new scope; instances cannot be cloned.","triggerScenarios":"Thrown at libs/langgraph/langgraph/stream/_mux.py:210 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Construct StreamMux with factories= taking callables of scope","Pass transformer classes or lambda scope: Transformer(scope) instead of instances"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","contentChangedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}