{"record":{"id":"0d9825f5062e46a9","repo":"iflytek/astron-agent","slug":"personality-ai-generate-param-empty","errorCode":"PERSONALITY_AI_GENERATE_PARAM_EMPTY","errorMessage":"ResponseEnum.PERSONALITY_AI_GENERATE_PARAM_EMPTY","messagePattern":"ResponseEnum\\.PERSONALITY_AI_GENERATE_PARAM_EMPTY","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"warning","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/bot/impl/PersonalityConfigServiceImpl.java","lineNumber":47,"sourceCode":"\n@Service\n@RequiredArgsConstructor\n@Slf4j\npublic class PersonalityConfigServiceImpl implements PersonalityConfigService {\n\n    private final PersonalityConfigMapper personalityConfigMapper;\n\n    private final PersonalityCategoryMapper personalityCategoryMapper;\n\n    private final PersonalityRoleMapper personalityRoleMapper;\n\n    private final OpenAiModelProcessService openAiModelProcessService;\n\n    @Override\n    public String aiGeneratedPersonality(String botName, String category, String info, String prompt) {\n        if (StringUtils.isBlank(botName) || StringUtils.isBlank(category) || StringUtils.isBlank(info)\n                || StringUtils.isBlank(prompt)) {\n            throw new BusinessException(ResponseEnum.PERSONALITY_AI_GENERATE_PARAM_EMPTY);\n        }\n        String answer;\n        try {\n            String format = smartFormat(I18nUtil.getMessage(\"personality.ai.generated\"), botName, category, info, prompt);\n            answer = openAiModelProcessService.processNonStreaming(format);\n        } catch (Exception e) {\n            log.error(\"aiGeneratedPersonality error, botName: {}, category: {}, info: {}, prompt: {}\", botName, category, info, prompt, e);\n            throw new BusinessException(ResponseEnum.PERSONALITY_AI_GENERATE_ERROR);\n        }\n        if (StringUtils.isBlank(answer)) {\n            throw new BusinessException(ResponseEnum.PERSONALITY_AI_GENERATE_ERROR);\n        }\n        return answer;\n    }\n\n    @Override\n    public String aiPolishing(String botName, String category, String info, String prompt, String personality) {\n        if (StringUtils.isBlank(botName) || StringUtils.isBlank(category) || StringUtils.isBlank(info)","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/bot/impl/PersonalityConfigServiceImpl.java#L29-L65","documentation":"The console backend throws PERSONALITY_AI_GENERATE_PARAM_EMPTY when aiGeneratedPersonality is called without all four required inputs (botName, category, info, prompt). The service refuses to build the AI prompt template unless every slot is non-blank, because the i18n prompt template would render with empty sections and produce a useless LLM call.","triggerScenarios":"Calling the AI-generate-personality endpoint with any of botName, category, info, or prompt omitted, null, or whitespace-only.","commonSituations":"Frontend forms submitted before all fields are filled; API consumers building requests by hand and skipping the 'info' field; empty strings sent as '' instead of omitted fields.","solutions":["Populate all four parameters (botName, category, info, prompt) in the request before calling the endpoint.","On the client, disable the generate button until all required fields are non-blank.","Return a field-level 400 validation error from the controller so the user knows which field is missing."],"exampleFix":"// before\naiGeneratedPersonality(\"MyBot\", \"\", \"some info\", \"write it\");\n// after\naiGeneratedPersonality(\"MyBot\", \"assistant\", \"some info\", \"write it\");","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(botName) || StringUtils.isBlank(category) || StringUtils.isBlank(info) || StringUtils.isBlank(prompt)) {\n    throw new IllegalArgumentException(\"botName, category, info and prompt are all required\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate all required fields in the controller/DTO with @NotBlank before reaching the service","Disable submit buttons in the UI until required inputs are filled","Use Bean Validation so missing fields yield 400 with field names"],"tags":["validation","missing-parameter","business-exception"],"backgroundTag":"missing-required-argument","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"}