iflytek/astron-agent · error · ValueError
max_wait_time must be greater than 0
Error message
max_wait_time must be greater than 0
What it means
_validate_parsing_wait_parameters rejects wait_for_parsing configurations where max_wait_time <= 0, since such a poller can never observe a completed parse. It is an upfront argument validation to prevent loops that make no forward progress.
Solutions
- Pass a positive max_wait_time (e.g. 300 seconds) to wait_for_parsing.
- Fix the config/env source producing the non-positive value; check unit conversion.
- If 'unlimited' was intended, use a large finite value instead of 0 — this API requires a positive bound.
- Add a validation step on the config object at startup so the bad value fails early.
Example fix
# before await wait_for_parsing(ds, doc, max_wait_time=0) # ValueError # after await wait_for_parsing(ds, doc, max_wait_time=300, poll_interval=2.0)
Defensive patterns
Strategy: validation
Validate before calling
assert max_wait_time > 0, "max_wait_time must be a positive number of seconds"
Type guard
def valid_wait(v) -> bool:
return isinstance(v, (int, float)) and v > 0 Try / catch
try:
await wait_for_parsing(ds, doc, max_wait_time=max_wait_time)
except ValueError as e:
logger.error(f"Invalid polling configuration: {e}")
raise Prevention
- Validate polling config at startup, before any parse is started
- Document that max_wait_time is seconds and must be positive
- Use explicit large finite values for 'long waits'; 0 does not mean unlimited
When it happens
Trigger: Calling wait_for_parsing with max_wait_time=0 (interpreted as 'no wait') or a negative value from a mis-parsed config, bad unit conversion (e.g. seconds vs milliseconds producing a tiny/negative number), or a None coerced through arithmetic.
Common situations: Config file specifying max_wait_time: 0 to mean 'unlimited'; environment variable parsing dropping a sign or unit; template defaults not substituted.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- poll_interval must be greater than 0
- All retry attempts failed
- API request failed
- Cannot provide both fileUrl and file parameters
- ChunkDeleteFailed
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/ab5049af1289beda.
Report an issue: GitHub.
Appendix: source
Thrown at core/knowledge/infra/ragflow/ragflow_client.py:957
"progress_msg": progress_msg.replace("\n", " | ")[:500],
}
def _format_parsing_snapshot(snapshot: Dict[str, Any]) -> str:
"""Format a compact status description for logs and propagated errors."""
return (
f"status={snapshot['status']}, progress={snapshot['progress']}, "
f"chunks={snapshot['chunk_count']}, tokens={snapshot['token_count']}, "
f"message={snapshot['progress_msg'] or '-'}"
)
def _validate_parsing_wait_parameters(
max_wait_time: int, poll_interval: float, max_status_errors: int
) -> None:
"""Reject polling configurations that cannot make forward progress."""
if max_wait_time <= 0:
raise ValueError("max_wait_time must be greater than 0")
if poll_interval <= 0:
raise ValueError("poll_interval must be greater than 0")
if max_status_errors <= 0:
raise ValueError("max_status_errors must be greater than 0")
async def _query_document_parsing_status(
dataset_id: str, doc_id: str
) -> tuple[Optional[Dict[str, Any]], Optional[Exception]]:
"""Return a document snapshot or the recoverable query error."""
try:
return await get_document_info(dataset_id, doc_id), None
except Exception as error:
return None, error
def _handle_parsing_status_error(
dataset_id: str,View on GitHub (pinned to 5e758547a8)