iflytek/astron-agent · error · ValueError
retry_delay must be non-negative
Error message
retry_delay must be non-negative
What it means
get_document_chunks validates retry_delay and raises ValueError when it is negative. A negative inter-poll delay is nonsensical (it would mean sleeping backwards), so the function rejects it immediately alongside the max_retries check.
Solutions
- Clamp before calling: retry_delay = max(0.0, computed_delay)
- Fix the backoff/config computation yielding the negative delay
- Validate timing config at startup and reject negatives
- Use the documented default retry_delay of 3.0 seconds
Example fix
// before chunks = await get_document_chunks(ds, doc_id, retry_delay=backoff) // after chunks = await get_document_chunks(ds, doc_id, retry_delay=max(0.0, backoff))
Defensive patterns
Strategy: validation
Validate before calling
def safe_retry_delay(v) -> float:
d = float(v) if v is not None else 3.0
if d < 0:
raise ValueError("retry_delay must be >= 0")
return d
chunks = await get_document_chunks(ds, doc_id, retry_delay=safe_retry_delay(cfg_delay)) Type guard
def is_valid_retry_delay(v) -> bool:
return isinstance(v, (int, float)) and not isinstance(v, bool) and v >= 0 Try / catch
try:
chunks = await get_document_chunks(ds, doc_id, retry_delay=d)
except ValueError as e:
logger.error("bad retry_delay: %s", e)
chunks = await get_document_chunks(ds, doc_id) # default 3.0 Prevention
- Clamp backoff computations with max(0.0, value)
- Check sign of multipliers in backoff formulas
- Validate timing-related config at load time
- Prefer documented defaults over computed delays when unsure
When it happens
Trigger: Calling get_document_chunks(dataset_id, doc_id, retry_delay=-1.0) or any negative float, usually from miscomputed backoff arithmetic (e.g. delay = base * factor with a negative factor) or bad config.
Common situations: Backoff formulas with negative multipliers; config/env values entered as negative numbers; wiring an elapsed-time delta (which can be negative) into retry_delay.
Related errors
- max_retries must be non-negative
- Dataset id= not visible to RAGFlow SDK; refusing to…
- Uploaded file is empty
- lengthRange must contain one or two integers
- lengthRange values must be greater than zero
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/202e51c75d569360.
Report an issue: GitHub.
Appendix: source
Thrown at core/knowledge/infra/ragflow/ragflow_utils.py:367
Get all chunks after parsing, retrying incomplete search snapshots.
Each attempt delegates to the canonical fail-closed paginator. RAGFlow
API errors and incomplete pagination therefore propagate instead of
being misreported as a valid empty document.
Args:
dataset_id: Dataset ID
doc_id: Document ID
max_retries: Maximum incomplete-snapshot retries (default: 15)
retry_delay: Delay between retries in seconds (default: 3.0)
Returns:
Complete chunk list, or an empty list after all empty retries.
"""
if max_retries < 0:
raise ValueError("max_retries must be non-negative")
if retry_delay < 0:
raise ValueError("retry_delay must be non-negative")
doc_info = await get_document_info(dataset_id, doc_id)
if doc_info is None:
raise RuntimeError(
f"RAGFlow document disappeared before chunk retrieval: doc={doc_id}"
)
expected_count = RagflowUtils._normalize_expected_chunk_count(
doc_info.get("chunk_count")
)
last_visible_count = 0
last_chunk_ids: Optional[tuple[str, ...]] = None
stable_partial_reads = 0
for attempt in range(max_retries + 1):
chunks = await fetch_all_document_chunks(dataset_id, doc_id, page_size=100)
last_visible_count = len(chunks)
has_complete_snapshot = (View on GitHub (pinned to 5e758547a8)