iflytek/astron-agent · error · Exception
Downloaded file is empty
Error message
Downloaded file is empty
What it means
Raised in RagflowUtils._download_url_file when a remote file fetched over HTTP arrives with zero bytes. It is a generic sentinel-style guard placed after `await response.read()`: the HTTP status was 200 (success), but the body contained no data, so the downloaded payload cannot be a valid document. The at-fault input is the `file` URL being downloaded — it points to a resource that resolves to an empty body, typically because the object storage object or upstream link is empty, was truncated by a proxy/redirect, or the URL no longer maps to real content. The function treats an empty download as unusable and aborts rather than passing empty bytes on to RAGFlow ingestion, which would otherwise produce a broken or meaningless knowledge-base document.
Solutions
- Verify the source URL actually serves file content
- Check for redirect-to-empty or range-request issues
- Reject the upload early with a clear user-facing message
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/knowledge/infra/ragflow/ragflow_utils.py:204 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/3a479ca940179d11.
Report an issue: GitHub.
Appendix: source
Thrown at core/knowledge/infra/ragflow/ragflow_utils.py:204
Returns:
(file content, filename)
"""
logger.info(f"Downloading file from URL: {file}")
async with aiohttp.ClientSession() as session:
async with session.get(file) as response:
if response.status != 200:
raise Exception(f"File download failed: HTTP {response.status}")
file_content = await response.read()
logger.info(f"Download completed: {len(file_content)} bytes")
# Get filename
filename = RagflowUtils._extract_filename_from_url(file, response)
# Validate downloaded content
if len(file_content) == 0:
raise Exception("Downloaded file is empty")
return file_content, filename
@staticmethod
def _extract_filename_from_url(file: str, response: Any) -> str:
"""
Extract filename from URL or response
Args:
file: Original URL
response: HTTP response object
Returns:
Extracted filename
"""
filename = None
# First try to get filename from HTTP response headersView on GitHub (pinned to 5e758547a8)