iflytek/astron-agent · error · CustomException
ParameterCheckException
ParameterCheckException
Error message
File ID is required
What it means
get_chunks() requires a non-empty Xinghuo file_id to poll file status and fetch chunks. When the argument is None or an empty string, it raises a CustomException with CodeEnum.ParameterCheckException before making any network call. This is a local guard, so no Xinghuo request was sent.
Solutions
- Pass a real file_id obtained from the split/upload response, e.g. get_chunks(file_id=file_id).
- Validate the id before calling: if not file_id: skip / return early in your own code.
- Check where the file_id originates; if split() succeeded it should return an id — log the split response to confirm its shape.
Example fix
# before
chunks = await get_chunks(file_id=result.get("fileId"))
# after
file_id = result.get("fileId")
if not file_id:
raise ValueError("split response did not contain fileId")
chunks = await get_chunks(file_id=file_id) Defensive patterns
Strategy: validation
Validate before calling
if not file_id or not str(file_id).strip():
raise ValueError("file_id must be a non-empty string before calling get_chunks") Type guard
def is_valid_file_id(v: object) -> bool:
return isinstance(v, str) and bool(v.strip()) Try / catch
try:
chunks = await get_chunks(file_id=file_id)
except CustomException as e:
if "File ID is required" in str(e):
logger.error("missing file_id — check upstream split result")
raise Prevention
- Always derive file_id from split()'s return value and assert it's truthy before proceeding.
- Make file_id a required positional parameter in your own wrappers.
- Fail fast in pipelines: stop ingestion if the split step yields no id.
When it happens
Trigger: Calling get_chunks(file_id=None), get_chunks() with the default, or with file_id=""/whitespace — typically because split() returned no id, the upstream split response lacked the file id field, or a caller passed an unpopulated dict value.
Common situations: Forgetting to extract the file_id from split()'s response; pipeline state where the upload step failed silently earlier; copying example code without providing file_id; a workflow variable that evaluates to empty string.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/5939e7a3765e4e43.
Report an issue: GitHub.
Appendix: source
Thrown at core/knowledge/infra/xinghuo/xinghuo.py:164
async def get_chunks(
file_id: Optional[str] = None, **kwargs: Any
) -> List[Dict[str, Any]]:
"""
Get document chunk content.
Args:
file_id: File ID
Returns:
List of document chunk content
Raises:
ThirdPartyException: Raised when document splitting fails
CustomException: Raised when unable to get chunk content
"""
if not file_id:
raise CustomException(CodeEnum.ParameterCheckException, "File ID is required")
max_retries = 70
retry_count = 0
data: Optional[List[Dict[str, Any]]] = None
while retry_count < max_retries:
file_status = await get_file_status(file_id=file_id, **kwargs)
if file_status and file_status[0]["fileStatus"] == "failed":
raise ThirdPartyException("Document splitting failed")
if file_status and file_status[0]["fileStatus"] in ["spliting", "ocring"]:
logger.info(
f"File: {file_id} - Retry {retry_count + 1}, document is being chunked, continuing to retry..."
)
retry_count += 1
if retry_count < max_retries:
await asyncio.sleep(4)
continueView on GitHub (pinned to 5e758547a8)