{"record":{"id":"1dfddb86355cb702","repo":"iflytek/astron-agent","slug":"max-status-errors-must-be-greater-than-0","errorCode":null,"errorMessage":"max_status_errors must be greater than 0","messagePattern":"max_status_errors must be greater than 0","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"core/knowledge/infra/ragflow/ragflow_client.py","lineNumber":961,"sourceCode":"def _format_parsing_snapshot(snapshot: Dict[str, Any]) -> str:\n    \"\"\"Format a compact status description for logs and propagated errors.\"\"\"\n    return (\n        f\"status={snapshot['status']}, progress={snapshot['progress']}, \"\n        f\"chunks={snapshot['chunk_count']}, tokens={snapshot['token_count']}, \"\n        f\"message={snapshot['progress_msg'] or '-'}\"\n    )\n\n\ndef _validate_parsing_wait_parameters(\n    max_wait_time: int, poll_interval: float, max_status_errors: int\n) -> None:\n    \"\"\"Reject polling configurations that cannot make forward progress.\"\"\"\n    if max_wait_time <= 0:\n        raise ValueError(\"max_wait_time must be greater than 0\")\n    if poll_interval <= 0:\n        raise ValueError(\"poll_interval must be greater than 0\")\n    if max_status_errors <= 0:\n        raise ValueError(\"max_status_errors must be greater than 0\")\n\n\nasync def _query_document_parsing_status(\n    dataset_id: str, doc_id: str\n) -> tuple[Optional[Dict[str, Any]], Optional[Exception]]:\n    \"\"\"Return a document snapshot or the recoverable query error.\"\"\"\n    try:\n        return await get_document_info(dataset_id, doc_id), None\n    except Exception as error:\n        return None, error\n\n\ndef _handle_parsing_status_error(\n    dataset_id: str,\n    doc_id: str,\n    error: Exception,\n    consecutive_errors: int,\n    max_status_errors: int,","sourceCodeStart":943,"sourceCodeEnd":979,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/knowledge/infra/ragflow/ragflow_client.py#L943-L979","documentation":"_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.","triggerScenarios":"Thrown at core/knowledge/infra/ragflow/ragflow_client.py:961 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass max_status_errors >= 1 when configuring wait_for_parsing","Use the default polling configuration instead of overriding it","Review callers that compute max_status_errors dynamically"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}