{"record":{"id":"b7d631dba60d62d8","repo":"iflytek/astron-agent","slug":"speaker-train-failed","errorCode":"SPEAKER_TRAIN_FAILED","errorMessage":"ResponseEnum.SPEAKER_TRAIN_FAILED","messagePattern":"ResponseEnum\\.SPEAKER_TRAIN_FAILED","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/bot/impl/SpeakerTrainServiceImpl.java","lineNumber":97,"sourceCode":"\n        // validate audio file\n        AudioValidator.validateAudioFile(file);\n\n        File tempFile = File.createTempFile(UUID.randomUUID().toString(), buildSafeTempFileSuffix(file.getOriginalFilename()));\n        try {\n            file.transferTo(tempFile);\n            // Create task\n            SexEnum sexEnum = sex.equals(1) ? SexEnum.MALE : SexEnum.FEMALE;\n            CreateTaskParam createTaskParam = CreateTaskParam.builder()\n                    .sex(sexEnum.getValue())\n                    .ageGroup(AgeGroupEnum.YOUTH.getValue())\n                    .language(language)\n                    .build();\n            VoiceTrainClient voiceTrainClient = buildVoiceTrainClient();\n            String taskResp = voiceTrainClient.createTask(createTaskParam);\n            JSONObject taskObj = JSONObject.parseObject(taskResp);\n            if (taskObj == null || !SUCCESS_CODE.equals(taskObj.get(\"code\"))) {\n                throw new BusinessException(ResponseEnum.SPEAKER_TRAIN_FAILED);\n            }\n            String taskId = taskObj.getString(\"data\");\n\n            // add audio\n            AudioAddParam audioAddParam2 = AudioAddParam.builder()\n                    .file(tempFile)\n                    .taskId(taskId)\n                    .textId(5001L)\n                    .textSegId(segId)\n                    .build();\n            String submitWithAudio = voiceTrainClient.submitWithAudio(audioAddParam2);\n            log.info(\"Task submission response: {}\", submitWithAudio);\n\n            // wait for training completion\n            waitForTrainingCompletion(taskId, spaceId, uid);\n            return taskId;\n        } catch (Exception e) {\n            log.error(\"create task failed\", e);","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/bot/impl/SpeakerTrainServiceImpl.java#L79-L115","documentation":"After calling the iflytek VoiceTrainClient.createTask, the service parses the response JSON and throws SPEAKER_TRAIN_FAILED if the body is unparseable/null or its 'code' field is not 0. It signals the voice-clone platform refused task creation.","triggerScenarios":"Voice-train platform returns non-zero code (auth failure, quota exceeded, invalid sex/language/ageGroup combination) or returns a non-JSON/empty body so taskObj is null.","commonSituations":"Wrong or expired platformAppId/platformApiKey in PlatformAccountService config; account lacks voice-clone entitlement; unsupported parameter combination; platform outage returning error payloads.","solutions":["Check the 'create task failed' log and the raw taskResp body for the platform error code/message.","Verify the iflytek open-platform appId/apiKey configuration (requireIflytekOpenPlatform) is valid and entitled for voice cloning.","Confirm CreateTaskParam values (sex, ageGroup, language) are accepted by the platform.","Retry later if the platform is degraded; contact iflytek support with the returned code."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check platform config\nPlatformAccountConfigDto.IflytekOpenPlatformConfig cfg = platformAccountService.requireIflytekOpenPlatform();\nif (cfg == null || StringUtils.isAnyBlank(cfg.getPlatformAppId(), cfg.getPlatformApiKey())) {\n    throw new IllegalStateException(\"iflytek open platform credentials not configured\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    String resp = voiceTrainClient.createTask(param);\n    JSONObject obj = JSONObject.parseObject(resp);\n    if (obj == null || !Integer.valueOf(0).equals(obj.getInteger(\"code\"))) {\n        log.error(\"createTask rejected: {}\", resp);\n        throw new BusinessException(ResponseEnum.SPEAKER_TRAIN_FAILED);\n    }\n} catch (BusinessException e) { throw e; }\ncatch (Exception e) { log.error(\"createTask call failed\", e); throw new BusinessException(ResponseEnum.SPEAKER_TRAIN_FAILED); }","preventionTips":["Validate platform appId/apiKey at startup and via health checks","Log full upstream responses for support tickets","Check voice-clone entitlement/quota on the platform account"],"tags":["voice-clone","upstream-api","auth","business-exception"],"backgroundTag":"upstream-api-error","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"}