iflytek/astron-agent · error · BusinessException

8001

8001

Error message

Failed to get RSA public key: 

What it means

Generic wrapper error (code 8001) thrown by ModelController.getRsaPublicKey when modelService.getPublicKey() throws any Exception. The controller logs the underlying stack trace and rethrows a BusinessException whose message embeds the original exception's message. The real cause is whatever the service failed on (missing key config, keystore/IO problems, etc.).

Solutions

  1. Read the log line 'Failed to get RSA public key' for the full stack trace to find the root cause.
  2. Verify the RSA key configuration (key path/properties) is present and correct in the service environment.
  3. Generate or install the RSA key pair per deployment docs and restart the service.
  4. Narrow the catch block so specific failures (e.g. missing key resource) surface as distinct error codes instead of the generic RESPONSE_FAILED.

Example fix

// before
throw new BusinessException(ResponseEnum.RESPONSE_FAILED, "Failed to get RSA public key: " + e.getMessage());
// after
log.error("Failed to get RSA public key", e);
throw new BusinessException(ResponseEnum.RESPONSE_FAILED, "Failed to get RSA public key: " + e.getClass().getSimpleName() + ": " + e.getMessage());
Defensive patterns

Strategy: try-catch

Validate before calling

// client: check endpoint health before relying on the key
const res = await fetch('/model/rsa-public-key');
if (!res.ok) throw new Error('key service unavailable: ' + res.status);

Try / catch

try {
  const key = await api.getRsaPublicKey();
} catch (e) {
  if (e.code === 8001) {
    // surface e.message's embedded cause to ops; check RSA key configuration
    showError('Key service misconfigured: ' + e.message);
  } else throw e;
}

Prevention

When it happens

Trigger: GET the RSA public key endpoint while the underlying key provider fails: key material not configured, file/classpath resource missing, or the service throws any runtime exception.

Common situations: RSA key pair not generated/installed in the deployment environment; wrong key path in configuration; missing config file after an upgrade; startup ordering where the key service is not yet initialized.

Related errors


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

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/controller/model/ModelController.java:73

        String uid = UserInfoManagerHandler.getUserId();
        dto.setUid(uid);
        dto.setSpaceId(SpaceInfoUtil.getSpaceId());
        return modelService.getList(dto, request);
    }

    @GetMapping("/detail")
    public ApiResult detail(@RequestParam(name = "llmSource") Integer llmSource, @RequestParam(name = "modelId") Long modelId, HttpServletRequest request) {
        return modelService.getDetail(llmSource, modelId, request);
    }

    @GetMapping("/rsa/public-key")
    public ApiResult getRsaPublicKey() {
        try {
            String publicKey = modelService.getPublicKey();
            return ApiResult.success(publicKey);
        } catch (Exception e) {
            log.error("Failed to get RSA public key", e);
            throw new BusinessException(ResponseEnum.RESPONSE_FAILED, "Failed to get RSA public key: " + e.getMessage());
        }
    }

    /**
     * Check model ownership
     *
     * @param llmId
     * @param serviceId
     * @param url
     * @return
     */
    @GetMapping("/check-model-base")
    public ApiResult checkModelBase(@RequestParam(name = "llmId") Long llmId,
            @RequestParam(name = "uid") String uid,
            @RequestParam(name = "spaceId", required = false) Long spaceId,
            @RequestParam(name = "serviceId") String serviceId,
            @RequestParam(name = "url") String url) {
        return ApiResult.success(modelService.checkModelBase(llmId, serviceId, url, uid, spaceId));

View on GitHub (pinned to 5e758547a8)