microsoft/graphrag · error · ValueError
max_retries must be greater than 1 for Immediate retry.
Error message
max_retries must be greater than 1 for Immediate retry.
What it means
RetryConfig validation requires max_retries > 1 for Immediate retry. Values of 1 or less are rejected even though the delay strategy is trivial.
Source
Thrown at packages/graphrag-llm/graphrag_llm/config/retry_config.py:60
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()
return self
View on GitHub (pinned to f40e9a26ce)
Solutions
- Set max_retries to at least 2
- If you want no retries, omit the retry config / set it to None rather than max_retries=0
Example fix
# before RetryConfig(type="immediate", max_retries=1) # after RetryConfig(type="immediate", max_retries=2)
Defensive patterns
Strategy: validation
Validate before calling
mr = retry_cfg.get("max_retries")
if retry_cfg.get("type") == "immediate" and mr is not None and mr <= 1:
raise ValueError("max_retries must be > 1") Prevention
- Set max_retries >= 2 or omit the retry block entirely for no retries
When it happens
Trigger: RetryConfig(type=RetryType.Immediate, max_retries=1) or 0/negative in settings.yaml.
Common situations: Trying to configure 'retry once' semantics; reducing retries during debugging and leaving max_retries=1 in the committed config.
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
- max_retries must be greater than 1 for Exponential Backoff r
- base_delay must be greater than 1.0 for Exponential Backoff
- max_delay must be greater than 1 for Exponential Backoff ret
- RetryConfig.type '{strategy}' is not registered in the Retry
- api_base must be specified with the 'azure' model provider.
AI-assisted analysis of microsoft/graphrag@f40e9a26ce (2026-08-27).
Data as JSON: /api/errors/7456c9db8881c2d4.
Report an issue: GitHub.