{"record":{"id":"a8d6f9299e645393","repo":"iflytek/astron-agent","slug":"audio-data-cannot-be-empty","errorCode":null,"errorMessage":"audio_data cannot be empty","messagePattern":"audio_data cannot be empty","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"core/plugin/aitools/service/ise/ise_evaluate_service.py","lineNumber":51,"sourceCode":"    group: str = (\n        \"adult\"  # Age group: pupil(Kindergarten)/youth(Elementary)/adult(Adult)\n    )\n\n    @field_validator(\"group\")\n    @classmethod\n    def validate_group(cls, value: str) -> str:\n        \"\"\"Validate group\"\"\"\n        valid_groups = [\"pupil\", \"youth\", \"adult\"]\n        if value not in valid_groups:\n            raise ValueError(f\"Invalid group: {value}. Valid options: {valid_groups}\")\n        return value\n\n    @field_validator(\"audio_data\")\n    @classmethod\n    def validate_audio_data(cls, value: str) -> str:\n        \"\"\"Validate audio_data\"\"\"\n        if not value:\n            raise ValueError(\"audio_data cannot be empty\")\n        try:\n            base64.b64decode(value)\n        except Exception as exc:\n            raise ValueError(\"audio_data must be valid base64 encoded string\") from exc\n        return value\n\n\n@api_service(\n    method=\"POST\",\n    path=\"/aitools/v1/ise\",\n    query=None,\n    body=ISEInput,\n    response=BaseResponse,\n    summary=\"ISE Evaluation\",\n    description=\"ISE Evaluation\",\n    tags=[\"public_cn\"],\n    deprecated=True,\n)","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/plugin/aitools/service/ise/ise_evaluate_service.py#L33-L69","documentation":"Pydantic field_validator on ISE evaluate request: audio_data (the base64 evaluation audio) is empty, so the request model rejects it. Oral-assessment scoring cannot run without an audio payload — the request never reaches the ISE service.","triggerScenarios":"Constructing the ISE evaluation request with audio_data='' or a falsy value.","commonSituations":"Recording produced a zero-byte file; the client-side uploader failed silently; a default '' was left in a form/model.","solutions":["Provide the base64-encoded audio bytes in audio_data","Check upstream recording/upload code for empty files","Fail fast in the caller before sending the request when audio is empty"],"exampleFix":"// before\nreq = IseEvaluateRequest(audio_data='', text=text)\n// after\nif not audio_bytes:\n    raise RuntimeError('no audio recorded')\nreq = IseEvaluateRequest(audio_data=base64.b64encode(audio_bytes).decode(), text=text)","handlingStrategy":"validation","validationCode":"if not audio_data:\n    raise ValueError('audio_data is required before calling the ISE API')","typeGuard":null,"tryCatchPattern":"try:\n    req = IseEvaluateRequest(audio_data=audio_data, text=text)\nexcept ValidationError as e:\n    if any('cannot be empty' in str(err['msg']) for err in e.errors()):\n        return error_response('please provide a recording')","preventionTips":["Check recorded audio byte length > 0 before encoding","Fail fast client-side on empty recordings","Never default audio fields to empty strings"],"tags":["validation","pydantic","audio"],"backgroundTag":"empty-required-field","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}