iflytek/astron-agent · error · BusinessException

SPEAKER_TRAIN_FAILED

SPEAKER_TRAIN_FAILED

Error message

ResponseEnum.SPEAKER_TRAIN_FAILED

What it means

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.

Solutions

  1. Check the 'create task failed' log and the raw taskResp body for the platform error code/message.
  2. Verify the iflytek open-platform appId/apiKey configuration (requireIflytekOpenPlatform) is valid and entitled for voice cloning.
  3. Confirm CreateTaskParam values (sex, ageGroup, language) are accepted by the platform.
  4. Retry later if the platform is degraded; contact iflytek support with the returned code.
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check platform config
PlatformAccountConfigDto.IflytekOpenPlatformConfig cfg = platformAccountService.requireIflytekOpenPlatform();
if (cfg == null || StringUtils.isAnyBlank(cfg.getPlatformAppId(), cfg.getPlatformApiKey())) {
    throw new IllegalStateException("iflytek open platform credentials not configured");
}

Try / catch

try {
    String resp = voiceTrainClient.createTask(param);
    JSONObject obj = JSONObject.parseObject(resp);
    if (obj == null || !Integer.valueOf(0).equals(obj.getInteger("code"))) {
        log.error("createTask rejected: {}", resp);
        throw new BusinessException(ResponseEnum.SPEAKER_TRAIN_FAILED);
    }
} catch (BusinessException e) { throw e; }
catch (Exception e) { log.error("createTask call failed", e); throw new BusinessException(ResponseEnum.SPEAKER_TRAIN_FAILED); }

Prevention

When it happens

Trigger: 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.

Common situations: Wrong or expired platformAppId/platformApiKey in PlatformAccountService config; account lacks voice-clone entitlement; unsupported parameter combination; platform outage returning error payloads.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/b7d631dba60d62d8. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/bot/impl/SpeakerTrainServiceImpl.java:97

        // validate audio file
        AudioValidator.validateAudioFile(file);

        File tempFile = File.createTempFile(UUID.randomUUID().toString(), buildSafeTempFileSuffix(file.getOriginalFilename()));
        try {
            file.transferTo(tempFile);
            // Create task
            SexEnum sexEnum = sex.equals(1) ? SexEnum.MALE : SexEnum.FEMALE;
            CreateTaskParam createTaskParam = CreateTaskParam.builder()
                    .sex(sexEnum.getValue())
                    .ageGroup(AgeGroupEnum.YOUTH.getValue())
                    .language(language)
                    .build();
            VoiceTrainClient voiceTrainClient = buildVoiceTrainClient();
            String taskResp = voiceTrainClient.createTask(createTaskParam);
            JSONObject taskObj = JSONObject.parseObject(taskResp);
            if (taskObj == null || !SUCCESS_CODE.equals(taskObj.get("code"))) {
                throw new BusinessException(ResponseEnum.SPEAKER_TRAIN_FAILED);
            }
            String taskId = taskObj.getString("data");

            // add audio
            AudioAddParam audioAddParam2 = AudioAddParam.builder()
                    .file(tempFile)
                    .taskId(taskId)
                    .textId(5001L)
                    .textSegId(segId)
                    .build();
            String submitWithAudio = voiceTrainClient.submitWithAudio(audioAddParam2);
            log.info("Task submission response: {}", submitWithAudio);

            // wait for training completion
            waitForTrainingCompletion(taskId, spaceId, uid);
            return taskId;
        } catch (Exception e) {
            log.error("create task failed", e);

View on GitHub (pinned to 5e758547a8)