iflytek/astron-agent · error · BusinessException

USER_APP_ID_NOT_EXISTE

USER_APP_ID_NOT_EXISTE

Error message

USER_APP_ID_NOT_EXISTE

What it means

USER_APP_ID_NOT_EXISTE (sic, typo of NOT_EXIST) is thrown by createBotApi when either the bot (chatBotDataService.findOne) or the target app (appMstService.getByAppId) is null. Publishing a bot API requires both a valid bot and a valid app; either being missing aborts with this code.

Solutions

  1. Verify the appId exists for this uid (query app_mst) and pick a valid app in the publish dialog.
  2. Verify the botId exists and belongs to uid+spaceId before calling createBotApi.
  3. Refresh the client's app/bot lists to remove stale deleted entities.
  4. If the app belongs to another user, create/select an app under the current account.

Example fix

// before
publishApiService.createBotApi(new CreateBotApiVo(botId, someAppId), request, uid, spaceId);
// after
AppMst app = appMstService.getByAppId(uid, someAppId);
ChatBotBase bot = chatBotDataService.findOne(uid, botId, spaceId);
if (bot == null || app == null) {
    throw new BusinessException(ResponseEnum.USER_APP_ID_NOT_EXISTE); // same as server; pre-validate
}
publishApiService.createBotApi(vo, request, uid, spaceId);
Defensive patterns

Strategy: validation

Validate before calling

ChatBotBase bot = chatBotDataService.findOne(uid, botId, spaceId);
AppMst app = appMstService.getByAppId(uid, appId);
if (bot == null || app == null) { throw new BusinessException(ResponseEnum.USER_APP_ID_NOT_EXISTE); }

Type guard

boolean publishable = botBase != null && appMst != null;

Try / catch

try { publishApiService.createBotApi(vo, request, uid, spaceId); }
catch (BusinessException e) { if (e.getCode() == ResponseEnum.USER_APP_ID_NOT_EXISTE) { refreshListsAndPromptReselection(); } else throw e; }

Prevention

When it happens

Trigger: createBotApi called with a botId that doesn't exist for the uid/space, or an appId that doesn't exist for the uid (e.g. app created by another user, deleted app, or mismatched IDs from stale client state).

Common situations: Frontend passes appId from a different account's dropdown; app was deleted while the publish dialog was open; bot deleted after listing; cross-space requests where filters exclude the entity.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

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

        String uid = RequestContextUtil.getUID();
        return createBotApi(createBotApiVo, request, uid);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public BotApiInfoDTO createBotApi(CreateBotApiVo createBotApiVo, HttpServletRequest request, String uid) {
        return createBotApi(createBotApiVo, request, uid, SpaceInfoUtil.getSpaceId());
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public BotApiInfoDTO createBotApi(CreateBotApiVo createBotApiVo, HttpServletRequest request, String uid, Long spaceId) {
        String uuid = UUID.randomUUID().toString();

        ChatBotBase botBase = chatBotDataService.findOne(uid, createBotApiVo.getBotId(), spaceId);
        AppMst appMst = appMstService.getByAppId(uid, createBotApiVo.getAppId());
        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 {

View on GitHub (pinned to 5e758547a8)