{"record":{"id":"211d20e278135a5d","repo":"iflytek/astron-agent","slug":"operation-failed","errorCode":"OPERATION_FAILED","errorMessage":"ResponseEnum.OPERATION_FAILED","messagePattern":"ResponseEnum\\.OPERATION_FAILED","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"warning","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/bot/impl/SpeakerTrainServiceImpl.java","lineNumber":77,"sourceCode":"                log.error(\"train text is blank\");\n                return null;\n            }\n            JSONObject object = JSONObject.parseObject(trainText);\n            if (object == null || !SUCCESS_CODE.equals(object.get(\"code\"))) {\n                log.error(\"train text parse failed\");\n                return null;\n            }\n            return object.getJSONObject(\"data\");\n        } catch (Exception e) {\n            log.error(\"one sentence get text failed\", e);\n        }\n        return null;\n    }\n\n    @Override\n    public String create(MultipartFile file, String language, Integer sex, Long segId, Long spaceId, String uid) throws Exception {\n        if (StringUtils.isNotBlank(language) && !SUPPORTED_LANGUAGES.contains(language)) {\n            throw new BusinessException(ResponseEnum.OPERATION_FAILED);\n        }\n\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);","sourceCodeStart":59,"sourceCodeEnd":95,"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#L59-L95","documentation":"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.","triggerScenarios":"Passing language values like 'zh-cn', 'zh_CN', 'english', 'fr', or any casing variant ('ZH') not exactly matching the supported set.","commonSituations":"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.","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."],"exampleFix":"// before\ncreate(file, \"zh-CN\", 1, segId, spaceId, uid); // throws\n// after\ncreate(file, \"zh\", 1, segId, spaceId, uid);","handlingStrategy":"validation","validationCode":"private static final Set<String> SUPPORTED = Set.of(\"zh\", \"en\", \"jp\", \"ko\", \"ru\");\nif (language != null && !SUPPORTED.contains(language)) {\n    throw new IllegalArgumentException(\"language must be one of zh, en, jp, ko, ru\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["validation","invalid-parameter","voice-clone","business-exception"],"backgroundTag":"invalid-enum-value","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"}