iflytek/astron-agent · error · BusinessException
SYSTEM_ERROR
SYSTEM_ERROR
Error message
SYSTEM_ERROR
What it means
generateImage wraps every unexpected failure (network errors, malformed JSON responses, null response bodies, non-401 HTTP failures) into a generic BusinessException with ResponseEnum.SYSTEM_ERROR. BusinessExceptions from the Spark API error mapping are re-thrown unchanged; anything else hits this catch-all. It means the image generation call failed for a reason the client did not specifically classify.
Solutions
- Check the service log for the 'Image generation request failed, user [...]' stack trace to find the real underlying exception
- Verify network connectivity from the console backend to http://spark-openapi.cn-huabei-1.xf-yun.com/v2.1/tti (proxy/firewall/DNS)
- Confirm the Spark API response shape still contains header.code; update parsing if the platform changed its response format
- Increase httpClient timeouts or add retry logic if failures correlate with load/latency
Example fix
// before
catch (Exception e) {
log.error("Image generation request failed, user [{}]", uid, e);
throw new BusinessException(ResponseEnum.SYSTEM_ERROR);
}
// after
catch (IOException e) {
log.error("Image generation network failure, user [{}]", uid, e);
throw new BusinessException(ResponseEnum.SPARK_API_ENGINE_NETWORK_ERROR);
} Defensive patterns
Strategy: try-catch
Validate before calling
if (uid == null || prompt == null || prompt.isBlank()) { throw new IllegalArgumentException("uid and prompt required"); } Try / catch
try { JSONObject r = client.generateImage(uid, prompt, size); } catch (BusinessException e) { log.error("Image gen failed: {}", e.getMessage()); return fallbackImageError(e); } Prevention
- Check service logs for the root cause stack trace before guessing
- Verify network egress to the Spark image endpoint from the deployment environment
- Validate uid/prompt are non-blank before calling
- Monitor Spark API response-shape changes after platform upgrades
When it happens
Trigger: generateImage(uid,prompt,size) throws this when: OkHttp call to the image host fails (DNS/connect/timeout), the response body is empty (IllegalStateException), the JSON response cannot be parsed (JSONObject.parseObject), header.code extraction throws NPE, or any other non-BusinessException RuntimeException occurs inside the try block.
Common situations: Spark image API endpoint unreachable from the deployment network (firewall/proxy), malformed or non-JSON response returned by a gateway, intermittent socket timeouts under load, or a bug in response parsing after a platform API change.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- sandbox-exec failed: HTTP
- Skill resource download failed: HTTP
- Skill resource download returned empty body
- exceeds size limit
- RESPONSE_FAILED
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/ad669ac06c054b6d.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/util/BotAIServiceClient.java:175
log.info("Image generation request completed, user [{}], response code: {}", uid, responseCode);
// Check if there is an error
if (responseCode != 0) {
log.error("Image generation service returned error, user [{}], error code: {}", uid, responseCode);
// Convert error code to corresponding ResponseEnum and throw
ResponseEnum responseEnum = convertImageErrorCodeToResponseEnum(responseCode);
throw new BusinessException(responseEnum);
}
return result;
}
} catch (BusinessException e) {
// Re-throw BusinessException directly
throw e;
} catch (Exception e) {
log.error("Image generation request failed, user [{}]", uid, e);
throw new BusinessException(ResponseEnum.SYSTEM_ERROR);
}
}
/**
* Text generation request (for opening lines generation and other functions)
*
* @param question Generation prompt
* @param domain Model domain
* @param seconds Timeout (seconds)
* @return Generated text content
* @throws BusinessException Business exception
*/
public String generateText(String question, String domain, int seconds) throws BusinessException, InterruptedException {
validateTextGenerationParams(question, domain, seconds);
PlatformAccountConfigDto.IflytekOpenPlatformConfig config =
platformAccountService.requireIflytekOpenPlatform();
TextGenerationWebSocketListener listener = null;View on GitHub (pinned to 5e758547a8)