microsoft/graphrag · error · ValueError

base_delay must be greater than 1.0 for Exponential Backoff

Error message

base_delay must be greater than 1.0 for Exponential Backoff retry.

What it means

RetryConfig validation requires base_delay > 1.0 seconds for Exponential Backoff. Delays of 1 second or less are considered too aggressive for backoff and rejected.

Source

Thrown at packages/graphrag-llm/graphrag_llm/config/retry_config.py:50

    jitter: bool | None = Field(
        default=None,
        description="Whether to apply jitter to the delay intervals in exponential backoff.",
    )

    max_delay: float | None = Field(
        default=None,
        description="The maximum delay in seconds between retries.",
    )

    def _validate_exponential_backoff_config(self) -> None:
        """Validate Exponential Backoff retry configuration."""
        if self.max_retries is not None and self.max_retries <= 1:
            msg = "max_retries must be greater than 1 for Exponential Backoff retry."
            raise ValueError(msg)

        if self.base_delay is not None and self.base_delay <= 1.0:
            msg = "base_delay must be greater than 1.0 for Exponential Backoff retry."
            raise ValueError(msg)

        if self.max_delay is not None and self.max_delay <= 1:
            msg = "max_delay must be greater than 1 for Exponential Backoff retry."
            raise ValueError(msg)

    def _validate_immediate_config(self) -> None:
        """Validate Immediate retry configuration."""
        if self.max_retries is not None and self.max_retries <= 1:
            msg = "max_retries must be greater than 1 for Immediate retry."
            raise ValueError(msg)

    @model_validator(mode="after")
    def _validate_model(self):
        """Validate the retry configuration based on its type."""
        if self.type == RetryType.ExponentialBackoff:
            self._validate_exponential_backoff_config()
        elif self.type == RetryType.Immediate:
            self._validate_immediate_config()

View on GitHub (pinned to f40e9a26ce)

Solutions

  1. Set base_delay above 1.0, e.g. 2.0 seconds
  2. For tests, monkeypatch/mock the retry sleeper rather than shrinking base_delay below the allowed minimum

Example fix

# before
RetryConfig(type="exponential_backoff", base_delay=0.5, max_retries=3)
# after
RetryConfig(type="exponential_backoff", base_delay=2.0, max_retries=3)
Defensive patterns

Strategy: validation

Validate before calling

bd = retry_cfg.get("base_delay")
if retry_cfg.get("type") == "exponential_backoff" and bd is not None and bd <= 1.0:
    raise ValueError("base_delay must be > 1.0 seconds")

Prevention

When it happens

Trigger: RetryConfig(type=RetryType.ExponentialBackoff, base_delay=1.0) or a sub-second value like 0.5 in settings.

Common situations: Porting defaults from another library (e.g. tenacity's 1.0s or 0.5s base); tuning for fast local tests without realizing the minimum is >1.0.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of microsoft/graphrag@f40e9a26ce (2026-08-27). Data as JSON: /api/errors/2cdca8e9342009d1. Report an issue: GitHub.