langchain-ai/langgraph · error

Accessing GraphOutput via `result[key]` is deprecated. Use…

Error message

Accessing GraphOutput via `result[key]` is deprecated. Use `result.value` to access the output value directly, or `result.interrupts` for interrupts.

What it means

Deprecation warning from GraphOutput.__getitem__: with version="v2" invoke returns a GraphOutput dataclass, not a dict, and old code indexing result['__interrupt__'] or result[key] goes through a compat shim. The access still succeeds (mapping onto result.interrupts or the underlying value) but the pattern is deprecated.

Solutions

  1. Use result.value to read the graph output and result.interrupts for interrupts
  2. Replace result['__interrupt__'] with result.interrupts
  3. Unpack GraphOutput explicitly instead of treating it as a dict
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at libs/langgraph/langgraph/types.py:384 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/bb95a3de8055a6dd. Report an issue: GitHub.

Appendix: source

Thrown at libs/langgraph/langgraph/types.py:384

```
"""


@dataclass(frozen=True)
class GraphOutput(Generic[OutputT]):
    """Typed container returned by `invoke()` / `ainvoke()` with `version="v2"`.

    Attributes:
        value: The final output of the graph (dict, Pydantic model, dataclass, etc.).
        interrupts: Any interrupts that occurred during execution.
    """

    value: OutputT
    interrupts: tuple[Interrupt, ...] = ()

    def __getitem__(self, key: str) -> Any:
        """Backward compat: `result['__interrupt__']` and dict-key access."""
        warn(
            "Accessing GraphOutput via `result[key]` is deprecated. "
            "Use `result.value` to access the output value directly, "
            "or `result.interrupts` for interrupts.",
            LangGraphDeprecatedSinceV11,
            stacklevel=2,
        )
        if key == _INTERRUPT_KEY:
            return self.interrupts
        if isinstance(self.value, dict):
            return self.value[key]
        try:
            return getattr(self.value, key)
        except AttributeError:
            raise KeyError(key)

    def __contains__(self, key: object) -> bool:
        warn(
            "Accessing GraphOutput via `key in result` is deprecated. "

View on GitHub (pinned to 38031739e5)