iflytek/astron-agent · error · IllegalArgumentException
Model domain cannot be empty
Error message
Model domain cannot be empty
What it means
validateTextGenerationParams rejects a null or blank 'domain' argument with IllegalArgumentException('Model domain cannot be empty'). The domain selects the Spark model (e.g. 'generalv3.5', '4.0Ultra') for the chat parameter block; without it the request would be rejected by the API, so it is validated up front.
Solutions
- Fix the caller to pass a valid non-blank domain matching the TEXT_HOST_URL API version (v4.0)
- Add a fallback default domain at the call site when the model config is missing
- Validate/normalize model config at bot-save time so domain is never null downstream
Example fix
// before String domain = botModelConfig.getDomain(); // may be null botAIServiceClient.generateText(prompt, domain, 30); // after String domain = StrUtil.blankToDefault(botModelConfig.getDomain(), "4.0Ultra"); botAIServiceClient.generateText(prompt, domain, 30);
Defensive patterns
Strategy: validation
Validate before calling
if (domain == null || domain.trim().isEmpty()) { domain = "4.0Ultra"; } // or reject early Try / catch
try { return client.generateText(q, domain, 60); } catch (IllegalArgumentException e) { log.warn("Invalid text-gen args: {}", e.getMessage()); return DEFAULT_TEXT; } Prevention
- Default the domain when the model config is missing
- Validate model config at save time so domain is never null
- Keep domain constants aligned with the endpoint API version
When it happens
Trigger: generateText(question, null, seconds) or generateText(question, "", seconds) or generateText(question, " ", seconds) — any caller passing an unset/whitespace domain string.
Common situations: Caller derives the domain from a model config that is missing or null (e.g. bot saved without a model field), config key renamed or deleted, or a hardcoded default removed during a model upgrade.
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
- Timeout must be between 1-300 seconds
- User UID cannot be null
- DUPLICATE_BOT_NAME
- PARAMETER_ERROR
- FILE_EMPTY
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/481ccf572cbb8788.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/util/BotAIServiceClient.java:245
return result;
} catch (Exception e) {
log.error("AI text generation service call exception", e);
if (e instanceof BusinessException) {
throw e;
}
throw new BusinessException(ResponseEnum.SYSTEM_ERROR);
}
}
/**
* Validate text generation parameters
*/
private void validateTextGenerationParams(String question, String domain, int seconds) {
if (question == null || question.trim().isEmpty()) {
throw new IllegalArgumentException("Generation prompt cannot be empty");
}
if (domain == null || domain.trim().isEmpty()) {
throw new IllegalArgumentException("Model domain cannot be empty");
}
if (seconds <= 0 || seconds > 300) {
throw new IllegalArgumentException("Timeout must be between 1-300 seconds");
}
}
/**
* Convert AI service error code to corresponding ResponseEnum
*
* @param errorCode Error code returned by AI service
* @return Corresponding ResponseEnum
*/
private ResponseEnum convertTextErrorCodeToResponseEnum(Integer errorCode) {
if (errorCode == null) {
return ResponseEnum.SYSTEM_ERROR;
}
ResponseEnum responseEnum = TEXT_ERROR_CODE_MAP.get(errorCode);View on GitHub (pinned to 5e758547a8)