langchain-ai/langgraph · error · ValueError

Channel ' ' already exists with a different type

Error message

Channel '{key}' already exists with a different type

What it means

Raised by StateGraph._add_schema when two schemas declare the same state key with incompatible channel types (only LastValue channels are allowed to silently collide). The conflicting key is named in the message.

Solutions

  1. Make both schemas annotate the key with the same channel/reducer
  2. Change one schema's key name to avoid the collision
  3. Use LastValue (plain un-annotated) on both sides if last-write-wins is acceptable
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at libs/langgraph/langgraph/graph/state.py:361 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/6536e31d552d9d93. Report an issue: GitHub.

Appendix: source

Thrown at libs/langgraph/langgraph/graph/state.py:361

    def _add_schema(self, schema: type[Any], /, allow_managed: bool = True) -> None:
        if schema not in self.schemas:
            _warn_invalid_state_schema(schema)
            channels, managed, type_hints = _get_channels(schema)
            if managed and not allow_managed:
                names = ", ".join(managed)
                schema_name = getattr(schema, "__name__", "")
                raise ValueError(
                    f"Invalid managed channels detected in {schema_name}: {names}."
                    " Managed channels are not permitted in Input/Output schema."
                )
            self.schemas[schema] = {**channels, **managed}
            for key, channel in channels.items():
                if key in self.channels:
                    if self.channels[key] != channel:
                        if isinstance(channel, LastValue):
                            pass
                        else:
                            raise ValueError(
                                f"Channel '{key}' already exists with a different type"
                            )
                else:
                    self.channels[key] = channel
            for key, managed in managed.items():
                if key in self.managed:
                    if self.managed[key] != managed:
                        raise ValueError(
                            f"Managed value '{key}' already exists with a different type"
                        )
                else:
                    self.managed[key] = managed

    @overload
    def add_node(
        self,
        node: StateNode[NodeInputT, ContextT],
        *,

View on GitHub (pinned to 38031739e5)