iflytek/astron-agent · warning · BusinessException
PARAMETER_ERROR
PARAMETER_ERROR
Error message
PARAMETER_ERROR
What it means
BotAIServiceImpl.sentenceBot throws BusinessException(PARAMETER_ERROR) when the one-sentence assistant description is blank. This is a guard clause at the very top of the method: the AI generation flow cannot build a bot from an empty description, so the service rejects the call before spending any model tokens. It maps to the platform's PARAMETER_ERROR response enum, meaning the caller supplied invalid input, not that the backend failed.
Solutions
- Trim the sentence and validate it is non-blank before calling sentenceBot
- Add @NotBlank on the request DTO field so bean validation rejects it earlier with a clearer message
- Return a 400 with a field-specific error from the controller instead of relying on the service guard
- Fix the client to disable the submit button until the description field has content
Example fix
// before
service.sentenceBot(request.getSentence(), uid);
// after
String sentence = StringUtils.trimToEmpty(request.getSentence());
if (StringUtils.isBlank(sentence)) {
throw new BusinessException(ResponseEnum.PARAMETER_ERROR, "sentence must not be blank");
}
service.sentenceBot(sentence, uid); Defensive patterns
Strategy: validation
Validate before calling
if (sentence == null || sentence.trim().isEmpty()) {
throw new IllegalArgumentException("sentence must not be blank");
} Type guard
boolean isValidSentence(String s) { return s != null && !s.trim().isEmpty(); } Try / catch
try {
dto = botAIService.sentenceBot(sentence, uid);
} catch (BusinessException e) {
if ("PARAMETER_ERROR".equals(e.getCode())) {
return ResponseEntity.badRequest().body(Map.of("message", "sentence must be 1-2000 non-blank characters"));
}
throw e;
} Prevention
- Trim user input before sending
- Use @NotBlank bean validation on DTOs
- Disable submit until the description field is filled
- Treat whitespace-only strings as empty
When it happens
Trigger: Calling sentenceBot(sentence, uid) with sentence == null, an empty string, or a whitespace-only string (StringUtils.isBlank). Any REST/controller path that forwards user-submitted one-sentence bot descriptions without server-side or client-side trimming/validation.
Common situations: Frontend submits a form with an untouched/empty description field; a script or API client sends an empty JSON field; whitespace-only input like ' ' sneaks past naive isEmpty checks; a bot copy/import pipeline passes an uninitialized description.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- User UID cannot be null
- Timed out acquiring distributed lock, please try again later
- Current user does not exist
- Distributed lock acquisition timeout, please try again later
- DUPLICATE_BOT_NAME
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/e6a09b66f5ae3f14.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/bot/impl/BotAIServiceImpl.java:289
log.info("User [{}] avatar generated and uploaded successfully: {}", uid, avatarUrl);
return avatarUrl;
} catch (BusinessException e) {
throw e;
} catch (Exception e) {
log.error("Exception occurred during AI avatar generation for user [{}]", uid, e);
return "Should return fallback content";
} finally {
IoUtil.close(imageInput);
IoUtil.close(compressImageInput);
}
}
@Override
public BotGenerationDTO sentenceBot(String sentence, String uid) {
if (StringUtils.isBlank(sentence)) {
throw new BusinessException(PARAMETER_ERROR);
}
if (sentence.length() > 2000) {
log.error("One-sentence assistant generation input too long: length={}", sentence.length());
throw new BusinessException(PARAMETER_ERROR);
}
try {
// Use AI service to generate assistant configuration
BotGenerationDTO botDetail = generateBotFromSentence(sentence);
// Generate AI avatar (optional, enable as needed)
String botName = botDetail.getBotName();
String botDesc = botDetail.getBotDesc();
if (StringUtils.isNotBlank(botName) && StringUtils.isNotBlank(botDesc)) {
try {
String avatarUrl = generateAvatar(uid, botName, botDesc);
if (StringUtils.isNotBlank(avatarUrl) && !avatarUrl.equals("Should return fallback content")) {View on GitHub (pinned to 5e758547a8)