langchain-ai/langgraph · error · TimeoutError

Result was not set before timeout.

Error message

Result was not set before timeout.

What it means

Timeout sentinel in the sync client's _BlockingResult: result(timeout) waited on a threading.Event for the tool call/stream result and the event was never set within the allotted time. The producer thread either stalled, died, or the wait was too short.

Solutions

  1. Pass a larger (or None) timeout when blocking on the result
  2. Check the producer side (stream reader thread / server) for stalls or missed terminal events
  3. Catch TimeoutError and retry or abort the stream cleanly
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at libs/sdk-py/langgraph_sdk/_sync/stream.py:166 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26). Data as JSON: /api/errors/a91e743cad0dc382. Report an issue: GitHub.

Appendix: source

Thrown at libs/sdk-py/langgraph_sdk/_sync/stream.py:166

        self._event = threading.Event()
        self._value: Any = None
        self._error: BaseException | None = None

    def set_result(self, value: Any) -> None:
        if self._event.is_set():
            return
        self._value = value
        self._event.set()

    def set_exception(self, error: BaseException) -> None:
        if self._event.is_set():
            return
        self._error = error
        self._event.set()

    def result(self, timeout: float | None = None) -> Any:
        if not self._event.wait(timeout):
            raise TimeoutError("Result was not set before timeout.")
        if self._error is not None:
            raise self._error
        return self._value

    def done(self) -> bool:
        return self._event.is_set()


class _SyncAgentModule:
    """Assistant graph helpers scoped to one sync thread stream."""

    def __init__(self, owner: SyncThreadStream) -> None:
        self._owner = owner

    def get_tree(
        self,
        *,
        xray: int | bool = False,

View on GitHub (pinned to 38031739e5)