iflytek/astron-agent · error · ValueError

max_status_errors must be greater than 0

Error message

max_status_errors must be greater than 0

What it means

_validate_parsing_wait_parameters raises when max_status_errors <= 0. This polling-config guard ensures wait_for_parsing can tolerate at least one transient status-check error; a zero/negative value would make the poll loop unable to make forward progress.

Solutions

  1. Pass max_status_errors >= 1 when configuring wait_for_parsing
  2. Use the default polling configuration instead of overriding it
  3. Review callers that compute max_status_errors dynamically
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/knowledge/infra/ragflow/ragflow_client.py:961 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/1dfddb86355cb702. Report an issue: GitHub.

Appendix: source

Thrown at core/knowledge/infra/ragflow/ragflow_client.py:961

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,
    doc_id: str,
    error: Exception,
    consecutive_errors: int,
    max_status_errors: int,

View on GitHub (pinned to 5e758547a8)