{"record":{"id":"30864d6da68c4bde","repo":"iflytek/astron-agent","slug":"file-id-is-required-for-split-operation","errorCode":null,"errorMessage":"File ID is required for split operation","messagePattern":"File ID is required for split operation","errorType":"exception","errorClass":"ThirdPartyException","httpStatus":null,"severity":"error","filePath":"core/knowledge/infra/xinghuo/xinghuo.py","lineNumber":94,"sourceCode":"    length_range: Optional[List[int]] = None,\n    **kwargs: Any,\n) -> Dict[str, Any]:\n    \"\"\"\n    Perform chunking processing on documents.\n\n    Args:\n        file_id: File ID\n        cut_off: Cutoff character list\n        length_range: Chunk length range\n\n    Returns:\n        Result data of chunking operation\n\n    Raises:\n        ThirdPartyException: Raised when chunking fails\n    \"\"\"\n    if not file_id:\n        raise ThirdPartyException(\"File ID is required for split operation\")\n\n    post_body = {\n        \"fileIds\": [file_id],\n        \"isSplitDefault\": False,\n        \"splitType\": \"wiki\",\n        \"wikiSplitExtends\": {},\n    }\n\n    split_chars = []\n    if cut_off:\n        for s in cut_off:\n            split_chars.append(\n                base64.b64encode(s.encode(\"utf-8\")).decode(encoding=\"utf-8\")\n            )\n\n    post_body[\"wikiSplitExtends\"] = {\n        \"chunkSeparators\": split_chars,\n        \"minChunkSize\": (","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/knowledge/infra/xinghuo/xinghuo.py#L76-L112","documentation":"The split() function in the Xinghuo (讯飞星火) ingestion client calls the chunking/split HTTP API, which requires a fileId to identify the document to split. It raises ThirdPartyException when file_id is falsy (None or empty string), failing fast before a doomed API call is made.","triggerScenarios":"Calling split(file_id=None) or split(\"\") — typically because the preceding upload step failed to return a file id, the upload response was parsed with the wrong key, or the id was lost between pipeline steps.","commonSituations":"Upload API response schema changed so the file id key no longer matches; upload silently failed but the pipeline continued; None propagated from a lookup miss in an ingestion DAG; env-specific Xinghuo upload misconfiguration.","solutions":["Check the file_id returned by the upload step and fail the pipeline there if it is missing","Verify the key used to extract the file id from the upload response matches the actual Xinghuo API response","Make split calls conditional on a truthy file_id and surface a clear upstream error","Add logging of the upload response before split to trace where the id is lost"],"exampleFix":"// before\nresult = await split(upload_result)  # upload_result['fileId'] may be missing\n// after\nfile_id = upload_result.get(\"fileId\")\nif not file_id:\n    raise PipelineError(f\"upload returned no file id: {upload_result}\")\nresult = await split(file_id)","handlingStrategy":"validation","validationCode":"if not file_id or not isinstance(file_id, str):\n    raise ValueError(f\"cannot split: invalid file_id {file_id!r}\")","typeGuard":"def has_file_id(v) -> bool:\n    return isinstance(v, str) and len(v.strip()) > 0","tryCatchPattern":"try:\n    result = await split(file_id)\nexcept ThirdPartyException as e:\n    if \"File ID is required\" in str(e):\n        logger.error(\"split skipped: no file id; upload result was %s\", upload_result)\n        raise PipelineError(\"upload step did not produce a file id\") from e\n    raise","preventionTips":["Fail fast at the upload step if no file id is returned","Verify the response key used to extract the file id from Xinghuo upload API","Guard pipeline steps so each requires the prior step's outputs explicitly","Log upload responses once when wiring a new environment to catch schema drift"],"tags":["xinghuo","file-processing","missing-argument"],"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-19T12:17:13.211Z"}