iflytek/astron-agent · error · ValueError
Unsupported file input
Error message
Unsupported file input: {file_input}. Only HTTP/HTTPS URLs are supported for string input. What it means
process_file raises when a string file_input is neither an http:// nor https:// URL (e.g. a bare path, ftp://, or data: URI). The generic input guard only supports HTTP(S) URLs for string input; UploadFile objects take the other branch.
Solutions
- Pass full http/https URLs for remote files
- Use the UploadFile path for local uploads
- Pre-normalize/whitelist supported URL schemes before calling
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/knowledge/infra/ragflow/ragflow_utils.py:277 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/91e750b1410c7328.
Report an issue: GitHub.
Appendix: source
Thrown at core/knowledge/infra/ragflow/ragflow_utils.py:277
return file_content, filename
@staticmethod
async def process_file(file_input: Union[str, UploadFile]) -> tuple[bytes, str]:
"""
Process file (download, read local file, or handle upload file)
Args:
file_input: File path/URL (str) or UploadFile object
Returns:
(file content, filename)
"""
if isinstance(file_input, str):
# URL logic: only support HTTP/HTTPS URLs
if file_input.startswith(("http://", "https://")):
return await RagflowUtils._download_url_file(file_input)
else:
raise ValueError(
f"Unsupported file input: {file_input}. "
"Only HTTP/HTTPS URLs are supported for string input."
)
else:
# Handle UploadFile objects
file_content = await file_input.read()
filename = file_input.filename or "uploaded_file"
logger.info(
"Processing uploaded file: %s, size: %d bytes",
filename,
len(file_content),
)
if len(file_content) == 0:
raise Exception("Uploaded file is empty")
# Reset file pointer for potential future readsView on GitHub (pinned to 5e758547a8)