iflytek/astron-agent · warning · BusinessException
OPERATION_FAILED
OPERATION_FAILED
Error message
ResponseEnum.OPERATION_FAILED
What it means
SpeakerTrainServiceImpl.create logs 'train text parse failed' and the caller maps the null result to ResponseEnum.OPERATION_FAILED. It means the external voice-cloning/training service returned a response whose JSON lacked the expected success code, so the one-sentence training result could not be produced.
Solutions
- Send exactly one of: 'zh', 'en', 'jp', 'ko', 'ru'.
- Normalize the client locale (e.g. 'zh-CN' -> 'zh') before calling.
- Add missing languages to SUPPORTED_LANGUAGES if the upstream voice-train platform now supports them.
- Return a dedicated INVALID_PARAM response code instead of generic OPERATION_FAILED for clearer client messaging.
Example fix
// before create(file, "zh-CN", 1, segId, spaceId, uid); // throws // after create(file, "zh", 1, segId, spaceId, uid);
Defensive patterns
Strategy: validation
Validate before calling
private static final Set<String> SUPPORTED = Set.of("zh", "en", "jp", "ko", "ru");
if (language != null && !SUPPORTED.contains(language)) {
throw new IllegalArgumentException("language must be one of zh, en, jp, ko, ru");
} Prevention
- Normalize client locales to the 2-letter codes before sending (zh-CN -> zh)
- Constrain the language selector in the UI to the supported set
- Centralize the supported-language list so client and server share it
When it happens
Trigger: Passing language values like 'zh-cn', 'zh_CN', 'english', 'fr', or any casing variant ('ZH') not exactly matching the supported set.
Common situations: Client sends BCP-47 locale tags instead of the two-letter codes; user selects a language the UI doesn't restrict; newer platform language not yet added to the constant set.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- PERSONALITY_AI_GENERATE_PARAM_EMPTY
- SPEAKER_TRAIN_FAILED
- Invalid RID value provided.
- User UID cannot be null
- User ID cannot be null
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/211d20e278135a5d.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/bot/impl/SpeakerTrainServiceImpl.java:77
log.error("train text is blank");
return null;
}
JSONObject object = JSONObject.parseObject(trainText);
if (object == null || !SUCCESS_CODE.equals(object.get("code"))) {
log.error("train text parse failed");
return null;
}
return object.getJSONObject("data");
} catch (Exception e) {
log.error("one sentence get text failed", e);
}
return null;
}
@Override
public String create(MultipartFile file, String language, Integer sex, Long segId, Long spaceId, String uid) throws Exception {
if (StringUtils.isNotBlank(language) && !SUPPORTED_LANGUAGES.contains(language)) {
throw new BusinessException(ResponseEnum.OPERATION_FAILED);
}
// 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);View on GitHub (pinned to 5e758547a8)