{"record":{"id":"e9d96425fe888e7f","repo":"langchain-ai/langgraph","slug":"streamtransformer-init-must-return-a-dict-got","errorCode":null,"errorMessage":"StreamTransformer.init() must return a dict, got {type(projection).__name__}","messagePattern":"StreamTransformer\\.init\\(\\) must return a dict, got (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/stream/_mux.py","lineNumber":242,"sourceCode":"            child.bind_apump(self._apump_fn)\n        return child\n\n    def _register(self, transformer: StreamTransformer) -> None:\n        \"\"\"Register a single transformer.\n\n        Calls `transformer.init()`, stores the transformer for event\n        processing, binds any StreamChannel instances in the projection,\n        and merges the projection into `extensions`.\n        \"\"\"\n        if transformer_requires_async(transformer) and not self.is_async:\n            raise RuntimeError(\n                f\"{type(transformer).__name__} requires an async run — \"\n                \"it overrides aprocess/afinalize/afail or sets \"\n                \"requires_async=True. Use astream(), not stream().\"\n            )\n        projection = transformer.init()\n        if not isinstance(projection, dict):\n            raise TypeError(\n                f\"StreamTransformer.init() must return a dict, \"\n                f\"got {type(projection).__name__}\"\n            )\n        conflicts = set(projection) & set(self.extensions)\n        if conflicts:\n            attributions = \", \".join(\n                f\"{key!r} (owned by {self._projection_owners[key]})\"\n                for key in sorted(conflicts)\n            )\n            raise ValueError(\n                f\"Transformer {type(transformer).__name__} returned \"\n                f\"projection keys that conflict with already-registered \"\n                f\"keys: {attributions}\"\n            )\n        is_native = bool(getattr(transformer, \"_native\", False))\n        self._transformers.append(transformer)\n        self._bind_and_wire(projection, native=is_native)\n        self.extensions.update(projection)","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/stream/_mux.py#L224-L260","documentation":"Error \"StreamTransformer.init() must return a dict, got {type(projection).__name__}\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/langgraph/langgraph/stream/_mux.py:242 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"}