iflytek/astron-agent · error · BusinessException
PARAM_ERROR
PARAM_ERROR
Error message
domain cannot be empty
What it means
PARAM_ERROR with message 'domain cannot be empty' is thrown by completeGooglePath when completing the API path for the Google (Gemini) provider. Google path completion needs the modelDomain to build the :generateContent endpoint, so a blank domain is rejected before the URL can be composed.
Solutions
- Set the model domain (e.g. gemini-1.5-pro / gemini-2.0-flash) in the request before saving/validating.
- In the console UI, pick the model domain from the dropdown instead of leaving it blank.
- If calling the API directly, include the 'domain' field in the payload.
- Ensure the provider is google only when a domain is actually available, or choose the matching provider.
Example fix
// before
{ "provider": "google", "endpoint": "https://generativelanguage.googleapis.com/v1beta/models" } // domain missing
// after
{ "provider": "google", "domain": "gemini-1.5-flash", "endpoint": "https://generativelanguage.googleapis.com/v1beta/models" } Defensive patterns
Strategy: validation
Validate before calling
if ("google".equals(provider) && (domain == null || domain.isBlank())) throw new IllegalArgumentException("domain is required for google-provider models"); Type guard
boolean hasGoogleDomain(ModelSaveRequest r) { return !"google".equals(r.getProvider()) || (r.getDomain() != null && !r.getDomain().isBlank()); } Try / catch
try { modelService.validateModel(req); } catch (BusinessException e) { if ("PARAM_ERROR".equals(e.getCode()) && String.valueOf(e.getMessage()).contains("domain cannot be empty")) { promptUserToSelectDomain(); } throw e; } Prevention
- Make the domain field mandatory in the form when provider=google.
- Default the domain to a sensible Gemini model id in API clients.
- Validate provider/domain pairing before submitting the request.
When it happens
Trigger: Saving or validating a model with provider=google whose request.getDomain() is null/blank, while the endpoint path lacks :generateContent/:streamGenerateContent, so completeApiPath -> completeGooglePath is reached with an empty domain.
Common situations: Frontend form submitted without selecting a model domain; import/migration scripts creating Google models without the domain field; API clients calling the save endpoint directly omitting domain.
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
- OPEN_AI_REQUEST_ERROR
- 8322
- app_id must not been empty
- LONG_CONTENT_MISS_FILE_INFO
- LONG_CONTENT_MISS_FILE_INFO
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/4931057d4fe2bded.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/model/ModelService.java:350
}
if (PROVIDER_GOOGLE.equals(provider)) {
return completeGooglePath(cleanedPath, modelDomain);
}
return completeOpenAICompatiblePath(cleanedPath);
}
private String completeAnthropicPath(String cleanedPath) {
if (!cleanedPath.matches(".*/messages/?$")) {
return cleanedPath.matches(".*/v\\d+$")
? cleanedPath + "/messages"
: cleanedPath + "/v1/messages";
}
return cleanedPath;
}
private String completeGooglePath(String cleanedPath, String modelDomain) {
if (StringUtils.isBlank(modelDomain)) {
throw new BusinessException(ResponseEnum.PARAM_ERROR, "domain cannot be empty");
}
if (cleanedPath.contains(":generateContent")) {
return cleanedPath;
}
if (cleanedPath.contains(":streamGenerateContent")) {
return cleanedPath.replace(":streamGenerateContent", ":generateContent");
}
String quotedDomain = Pattern.quote(modelDomain);
if (cleanedPath.matches(".*/v\\d+(beta)?/models/" + quotedDomain + "/?$")) {
return cleanedPath + ":generateContent";
}
if (cleanedPath.matches(".*/v\\d+(beta)?/?$")) {
return cleanedPath + "/models/" + modelDomain + ":generateContent";
}
return appendPathSegment(cleanedPath, "/v1beta/models/" + modelDomain + ":generateContent");
}
private String completeOpenAICompatiblePath(String cleanedPath) {View on GitHub (pinned to 5e758547a8)