{"record":{"id":"bc3f97db80a0ee01","repo":"iflytek/astron-agent","slug":"getfilecontentfailed","errorCode":"GetFileContentFailed","errorMessage":"Xinghuo knowledge base failed to get document chunk content data","messagePattern":"Xinghuo knowledge base failed to get document chunk content data","errorType":"error_code","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/knowledge/infra/xinghuo/xinghuo.py","lineNumber":209,"sourceCode":"\n        if response:\n            # Response could be a dict or list, handle both cases\n            if isinstance(response, list):\n                data = response\n            else:\n                # If response is a dict, wrap it in a list to match expected type\n                data = [response] if response else []\n            break\n\n        logger.info(\n            f\"File: {file_id} - Retry {retry_count + 1}, document chunk content not obtained, continuing to retry...\"\n        )\n        retry_count += 1\n        if retry_count < max_retries:\n            await asyncio.sleep(4)\n\n    if not data:\n        raise CustomException(\n            CodeEnum.GetFileContentFailed,\n            \"Xinghuo knowledge base failed to get document chunk content data\",\n        )\n\n    # Ensure data is properly typed as List[Dict[str, Any]]\n    return data if isinstance(data, list) else []\n\n\nasync def new_topk_search(\n    query: str,\n    doc_ids: Optional[List[str]] = None,\n    top_n: Optional[int] = 5,\n    **kwargs: Any,\n) -> Dict[str, Any]:\n    \"\"\"\n    Use new retrieval interface for hybrid search.\n\n    Args:","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/knowledge/infra/xinghuo/xinghuo.py#L191-L227","documentation":"get_chunks() polls for up to 70 iterations (4s apart, ~4.7 minutes) waiting for the chunks endpoint to return data. If after all retries `data` is still empty/None, it raises CustomException with CodeEnum.GetFileContentFailed. It indicates the Xinghuo service never produced retrievable chunk content within the polling window.","triggerScenarios":"Polling a file whose status stays \"spliting\"/\"ocring\" beyond 70 retries (very large document, stuck job), or a file whose chunks endpoint keeps returning an empty response despite a non-failed status.","commonSituations":"Very large PDFs whose OCR exceeds ~5 minutes; jobs silently stuck server-side; file_id pointing to a file with no chunks (e.g. empty document); slow Xinghuo service under load so the polling budget expires.","solutions":["Check get_file_status(): if still splitting, wait and call get_chunks() again later.","Re-trigger the split for the document; if it completes faster the next time, this was a transient stall.","For very large files, increase max_retries or the sleep interval, or split the source document into smaller files.","Verify the file_id is correct — polling a wrong/nonexistent id yields empty responses until the budget runs out."],"exampleFix":"# before\nchunks = await get_chunks(file_id=file_id)\n# after\ntry:\n    chunks = await get_chunks(file_id=file_id)\nexcept CustomException:\n    await asyncio.sleep(60)\n    chunks = await get_chunks(file_id=file_id)  # retry once after long processing","handlingStrategy":"retry","validationCode":"status = await get_file_status(file_id=file_id)\nif not status:\n    raise ValueError(f\"no status found for file {file_id}; verify the id\")","typeGuard":"def chunks_ready(response: object) -> bool:\n    return isinstance(response, list) and len(response) > 0","tryCatchPattern":"try:\n    chunks = await get_chunks(file_id=file_id)\nexcept CustomException as e:\n    if \"chunk content\" in str(e):\n        await asyncio.sleep(120)  # long job may still be processing\n        chunks = await get_chunks(file_id=file_id)\n    else:\n        raise","preventionTips":["For very large documents, budget more than ~4.7 minutes of polling or split files smaller.","Confirm the file id exists remotely before starting a 70-retry poll.","Alert on files stuck in 'spliting'/'ocring' to catch server-side stalls early."],"tags":["rag","timeout","polling","retry-exhausted","third-party"],"backgroundTag":"request-timeout","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}