langchain-ai/langgraph · error · TypeError

StreamTransformer.init() must return a dict, got {type(proje

Error message

StreamTransformer.init() must return a dict, got {type(projection).__name__}

What it means

Error "StreamTransformer.init() must return a dict, got {type(projection).__name__}" thrown in langchain-ai/langgraph.

Source

Thrown at libs/langgraph/langgraph/stream/_mux.py:242

            child.bind_apump(self._apump_fn)
        return child

    def _register(self, transformer: StreamTransformer) -> None:
        """Register a single transformer.

        Calls `transformer.init()`, stores the transformer for event
        processing, binds any StreamChannel instances in the projection,
        and merges the projection into `extensions`.
        """
        if transformer_requires_async(transformer) and not self.is_async:
            raise RuntimeError(
                f"{type(transformer).__name__} requires an async run — "
                "it overrides aprocess/afinalize/afail or sets "
                "requires_async=True. Use astream(), not stream()."
            )
        projection = transformer.init()
        if not isinstance(projection, dict):
            raise TypeError(
                f"StreamTransformer.init() must return a dict, "
                f"got {type(projection).__name__}"
            )
        conflicts = set(projection) & set(self.extensions)
        if conflicts:
            attributions = ", ".join(
                f"{key!r} (owned by {self._projection_owners[key]})"
                for key in sorted(conflicts)
            )
            raise ValueError(
                f"Transformer {type(transformer).__name__} returned "
                f"projection keys that conflict with already-registered "
                f"keys: {attributions}"
            )
        is_native = bool(getattr(transformer, "_native", False))
        self._transformers.append(transformer)
        self._bind_and_wire(projection, native=is_native)
        self.extensions.update(projection)

View on GitHub (pinned to 38031739e5)

When it happens

Trigger: Thrown at libs/langgraph/langgraph/stream/_mux.py:242 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/e9d96425fe888e7f. Report an issue: GitHub.