langchain-ai/langgraph · error · ValueError

must be greater than 0

Error message

{field} must be greater than 0

What it means

Raised by timeout/retry policy coercion when a numeric field (run_timeout, idle_timeout, or similar) is not greater than 0. The field name is interpolated; zero/negative timeouts are rejected as nonsensical.

Solutions

  1. Pass a positive number of seconds
  2. Pass None to disable that timeout dimension
  3. Use TimeoutPolicy(...) to construct valid policies explicitly
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    """Maximum amount of time that may elapse between retries. In seconds."""
    max_attempts: int = 3
    """Maximum number of attempts to make before giving up, including the first."""
    jitter: bool = True
    """Whether to add random jitter to the interval between retries."""
    retry_on: (
        type[Exception] | Sequence[type[Exception]] | Callable[[Exception], bool]
    ) = default_retry_on
    """List of exception classes that should trigger a retry, or a callable that returns `True` for exceptions that should trigger a retry."""


def _coerce_timeout_seconds(
    value: float | timedelta | None, *, field: str
) -> float | None:
    if value is None:
        return None
    seconds = value.total_seconds() if isinstance(value, timedelta) else float(value)
    if seconds <= 0:
        raise ValueError(f"{field} must be greater than 0")
    return seconds


@dataclass(**_DC_KWARGS)
class TimeoutPolicy:
    """Configuration for timing out node attempts.

    !!! note "Cooperative cancellation"

        Timeouts rely on asyncio cancellation. If your node uses synchronous
        time.sleep() or other CPU-bound work that blocks the GIL, the timeout will not
        be fired until after the event loop has been released.

    !!! note "Inline callback dispatch"

        Under `refresh_on="auto"`, an internal handler refreshes the timeout on any
        callback event that occurs in the execution of the node or its nested descendants.
    """

View on GitHub (pinned to 38031739e5)