iflytek/astron-agent · warning · BusinessException

PERSONALITY_AI_GENERATE_PARAM_EMPTY

PERSONALITY_AI_GENERATE_PARAM_EMPTY

Error message

ResponseEnum.PERSONALITY_AI_GENERATE_PARAM_EMPTY

What it means

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.

Solutions

  1. Populate all four parameters (botName, category, info, prompt) in the request before calling the endpoint.
  2. On the client, disable the generate button until all required fields are non-blank.
  3. Return a field-level 400 validation error from the controller so the user knows which field is missing.

Example fix

// before
aiGeneratedPersonality("MyBot", "", "some info", "write it");
// after
aiGeneratedPersonality("MyBot", "assistant", "some info", "write it");
Defensive patterns

Strategy: validation

Validate before calling

if (StringUtils.isBlank(botName) || StringUtils.isBlank(category) || StringUtils.isBlank(info) || StringUtils.isBlank(prompt)) {
    throw new IllegalArgumentException("botName, category, info and prompt are all required");
}

Prevention

When it happens

Trigger: Calling the AI-generate-personality endpoint with any of botName, category, info, or prompt omitted, null, or whitespace-only.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

@Service
@RequiredArgsConstructor
@Slf4j
public class PersonalityConfigServiceImpl implements PersonalityConfigService {

    private final PersonalityConfigMapper personalityConfigMapper;

    private final PersonalityCategoryMapper personalityCategoryMapper;

    private final PersonalityRoleMapper personalityRoleMapper;

    private final OpenAiModelProcessService openAiModelProcessService;

    @Override
    public String aiGeneratedPersonality(String botName, String category, String info, String prompt) {
        if (StringUtils.isBlank(botName) || StringUtils.isBlank(category) || StringUtils.isBlank(info)
                || StringUtils.isBlank(prompt)) {
            throw new BusinessException(ResponseEnum.PERSONALITY_AI_GENERATE_PARAM_EMPTY);
        }
        String answer;
        try {
            String format = smartFormat(I18nUtil.getMessage("personality.ai.generated"), botName, category, info, prompt);
            answer = openAiModelProcessService.processNonStreaming(format);
        } catch (Exception e) {
            log.error("aiGeneratedPersonality error, botName: {}, category: {}, info: {}, prompt: {}", botName, category, info, prompt, e);
            throw new BusinessException(ResponseEnum.PERSONALITY_AI_GENERATE_ERROR);
        }
        if (StringUtils.isBlank(answer)) {
            throw new BusinessException(ResponseEnum.PERSONALITY_AI_GENERATE_ERROR);
        }
        return answer;
    }

    @Override
    public String aiPolishing(String botName, String category, String info, String prompt, String personality) {
        if (StringUtils.isBlank(botName) || StringUtils.isBlank(category) || StringUtils.isBlank(info)

View on GitHub (pinned to 5e758547a8)