iflytek/astron-agent · error · CustomException
GetFileContentFailed
GetFileContentFailed
Error message
Xinghuo knowledge base failed to get document chunk content data
What it means
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.
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.
Example fix
# before
chunks = await get_chunks(file_id=file_id)
# after
try:
chunks = await get_chunks(file_id=file_id)
except CustomException:
await asyncio.sleep(60)
chunks = await get_chunks(file_id=file_id) # retry once after long processing Defensive patterns
Strategy: retry
Validate before calling
status = await get_file_status(file_id=file_id)
if not status:
raise ValueError(f"no status found for file {file_id}; verify the id") Type guard
def chunks_ready(response: object) -> bool:
return isinstance(response, list) and len(response) > 0 Try / catch
try:
chunks = await get_chunks(file_id=file_id)
except CustomException as e:
if "chunk content" in str(e):
await asyncio.sleep(120) # long job may still be processing
chunks = await get_chunks(file_id=file_id)
else:
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.
Related errors
- Document splitting failed after retries
- Document splitting failed
- {desc from XINGHUO-RAG response}
- Failed to 【XINGHUO-RAG】; code
- RAGFLOW_RAGError
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/bc3f97db80a0ee01.
Report an issue: GitHub.
Appendix: source
Thrown at core/knowledge/infra/xinghuo/xinghuo.py:209
if response:
# Response could be a dict or list, handle both cases
if isinstance(response, list):
data = response
else:
# If response is a dict, wrap it in a list to match expected type
data = [response] if response else []
break
logger.info(
f"File: {file_id} - Retry {retry_count + 1}, document chunk content not obtained, continuing to retry..."
)
retry_count += 1
if retry_count < max_retries:
await asyncio.sleep(4)
if not data:
raise CustomException(
CodeEnum.GetFileContentFailed,
"Xinghuo knowledge base failed to get document chunk content data",
)
# Ensure data is properly typed as List[Dict[str, Any]]
return data if isinstance(data, list) else []
async def new_topk_search(
query: str,
doc_ids: Optional[List[str]] = None,
top_n: Optional[int] = 5,
**kwargs: Any,
) -> Dict[str, Any]:
"""
Use new retrieval interface for hybrid search.
Args:View on GitHub (pinned to 5e758547a8)