{"record":{"id":"5939e7a3765e4e43","repo":"iflytek/astron-agent","slug":"parametercheckexception","errorCode":"ParameterCheckException","errorMessage":"File ID is required","messagePattern":"File ID is required","errorType":"error_code","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/knowledge/infra/xinghuo/xinghuo.py","lineNumber":164,"sourceCode":"\nasync def get_chunks(\n    file_id: Optional[str] = None, **kwargs: Any\n) -> List[Dict[str, Any]]:\n    \"\"\"\n    Get document chunk content.\n\n    Args:\n        file_id: File ID\n\n    Returns:\n        List of document chunk content\n\n    Raises:\n        ThirdPartyException: Raised when document splitting fails\n        CustomException: Raised when unable to get chunk content\n    \"\"\"\n    if not file_id:\n        raise CustomException(CodeEnum.ParameterCheckException, \"File ID is required\")\n\n    max_retries = 70\n    retry_count = 0\n    data: Optional[List[Dict[str, Any]]] = None\n\n    while retry_count < max_retries:\n        file_status = await get_file_status(file_id=file_id, **kwargs)\n        if file_status and file_status[0][\"fileStatus\"] == \"failed\":\n            raise ThirdPartyException(\"Document splitting failed\")\n\n        if file_status and file_status[0][\"fileStatus\"] in [\"spliting\", \"ocring\"]:\n            logger.info(\n                f\"File: {file_id} - Retry {retry_count + 1}, document is being chunked, continuing to retry...\"\n            )\n            retry_count += 1\n            if retry_count < max_retries:\n                await asyncio.sleep(4)\n                continue","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/knowledge/infra/xinghuo/xinghuo.py#L146-L182","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nchunks = await get_chunks(file_id=result.get(\"fileId\"))\n# after\nfile_id = result.get(\"fileId\")\nif not file_id:\n    raise ValueError(\"split response did not contain fileId\")\nchunks = await get_chunks(file_id=file_id)","handlingStrategy":"validation","validationCode":"if not file_id or not str(file_id).strip():\n    raise ValueError(\"file_id must be a non-empty string before calling get_chunks\")","typeGuard":"def is_valid_file_id(v: object) -> bool:\n    return isinstance(v, str) and bool(v.strip())","tryCatchPattern":"try:\n    chunks = await get_chunks(file_id=file_id)\nexcept CustomException as e:\n    if \"File ID is required\" in str(e):\n        logger.error(\"missing file_id — check upstream split result\")\n    raise","preventionTips":["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."],"tags":["parameter-validation","missing-argument","rag"],"backgroundTag":"missing-required-argument","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}