iflytek/astron-agent · error · BusinessException

BOT_API_CREATE_ERROR

BOT_API_CREATE_ERROR

Error message

BOT_API_CREATE_ERROR

What it means

BOT_API_CREATE_ERROR is the catch-all thrown when any non-BusinessException escapes the createBotApi try block (after BOT_TYPE_NOT_SUPPORT dispatch). It wraps unexpected failures during MaaS API creation (createMaasApi) — network errors, tenant/model-service exceptions, NPEs — after logging the full request and stack trace. The Redis lock is still released in finally.

Solutions

  1. Read the logged 'create Bot api error' stack trace (log.error includes the full request) to find the root cause; the wrapper hides it.
  2. Check health/connectivity of downstream MaaS/tenant services and retry once restored.
  3. Validate the app's apiKey/apiSecret are present and valid before publishing.
  4. Fix the underlying NPE/bug in createMaasApi if the trace points to code, then redeploy.

Example fix

// before
catch (Exception e) {
    throw new BusinessException(ResponseEnum.BOT_API_CREATE_ERROR); // root cause only in logs
}
// after
catch (Exception e) {
    log.error("createBotApi failed: uid={}, botId={}, appId={}", uid, vo.getBotId(), vo.getAppId(), e);
    throw new BusinessException(ResponseEnum.BOT_API_CREATE_ERROR, e.getMessage()); // surface cause
}
Defensive patterns

Strategy: try-catch

Try / catch

try { publishApiService.createBotApi(vo, request, uid, spaceId); }
catch (BusinessException e) {
    if (e.getCode() == ResponseEnum.BOT_API_CREATE_ERROR) { logAndRetryOrEscalate(e); } // root cause is in server log.error
    else throw e;
}

Prevention

When it happens

Trigger: createMaasApi throws a runtime exception: tenant/MaaS HTTP call fails, NPE on unexpected response shape, DB error inside the flow — anything not itself a BusinessException.

Common situations: MaaS endpoint misconfigured or down mid-deploy; auth credentials (apiKey/secret) invalid at tenant; timeout on outbound HTTP during API registration; regressions after upgrading dependent services.

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


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

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApiServiceImpl.java:156

        if (Objects.isNull(botBase) || Objects.isNull(appMst)) {
            throw new BusinessException(ResponseEnum.USER_APP_ID_NOT_EXISTE);
        }

        if (!redisUtil.tryLock(PUBLISH_API + uid, 3000, uuid)) {
            throw new BusinessException(ResponseEnum.BOT_API_CREATE_LIMIT_ERROR);
        }
        try {
            List<Integer> maasSupportedVersions = List.of(BotVersionEnum.WORKFLOW.getVersion());
            if (maasSupportedVersions.contains(botBase.getVersion())) {
                return createMaasApi(uid, appMst, botBase, spaceId, request);
            } else {
                throw new BusinessException(ResponseEnum.BOT_TYPE_NOT_SUPPORT);
            }
        } catch (BusinessException e) {
            throw e;
        } catch (Exception e) {
            log.error("PublishApiServiceImpl.createBotApi : create Bot api error, request: {}", createBotApiVo, e);
            throw new BusinessException(ResponseEnum.BOT_API_CREATE_ERROR);
        } finally {
            redisUtil.unlock(PUBLISH_API + uid, uuid);
        }

    }

    @Override
    public BotApiInfoDTO getApiInfo(Long botId) {
        String uid = RequestContextUtil.getUID();
        ChatBotBase botBase = chatBotDataService.findOne(uid, botId);
        if (Objects.isNull(botBase)) {
            throw new BusinessException(ResponseEnum.BOT_NOT_EXISTS);
        }
        ChatBotApi botApi = chatBotApiService.getOneByUidAndBotId(uid, botId);
        if (Objects.isNull(botApi)) {
            return new BotApiInfoDTO();
        }
        AppMst appMst = appMstService.getByAppId(uid, botApi.getAppId());

View on GitHub (pinned to 5e758547a8)