{"record":{"id":"57103934bab2f2cf","repo":"iflytek/astron-agent","slug":"user-app-id-not-existe","errorCode":"USER_APP_ID_NOT_EXISTE","errorMessage":"USER_APP_ID_NOT_EXISTE","messagePattern":"USER_APP_ID_NOT_EXISTE","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApiServiceImpl.java","lineNumber":139,"sourceCode":"        String uid = RequestContextUtil.getUID();\n        return createBotApi(createBotApiVo, request, uid);\n    }\n\n    @Override\n    @Transactional(rollbackFor = Exception.class)\n    public BotApiInfoDTO createBotApi(CreateBotApiVo createBotApiVo, HttpServletRequest request, String uid) {\n        return createBotApi(createBotApiVo, request, uid, SpaceInfoUtil.getSpaceId());\n    }\n\n    @Override\n    @Transactional(rollbackFor = Exception.class)\n    public BotApiInfoDTO createBotApi(CreateBotApiVo createBotApiVo, HttpServletRequest request, String uid, Long spaceId) {\n        String uuid = UUID.randomUUID().toString();\n\n        ChatBotBase botBase = chatBotDataService.findOne(uid, createBotApiVo.getBotId(), spaceId);\n        AppMst appMst = appMstService.getByAppId(uid, createBotApiVo.getAppId());\n        if (Objects.isNull(botBase) || Objects.isNull(appMst)) {\n            throw new BusinessException(ResponseEnum.USER_APP_ID_NOT_EXISTE);\n        }\n\n        if (!redisUtil.tryLock(PUBLISH_API + uid, 3000, uuid)) {\n            throw new BusinessException(ResponseEnum.BOT_API_CREATE_LIMIT_ERROR);\n        }\n        try {\n            List<Integer> maasSupportedVersions = List.of(BotVersionEnum.WORKFLOW.getVersion());\n            if (maasSupportedVersions.contains(botBase.getVersion())) {\n                return createMaasApi(uid, appMst, botBase, spaceId, request);\n            } else {\n                throw new BusinessException(ResponseEnum.BOT_TYPE_NOT_SUPPORT);\n            }\n        } catch (BusinessException e) {\n            throw e;\n        } catch (Exception e) {\n            log.error(\"PublishApiServiceImpl.createBotApi : create Bot api error, request: {}\", createBotApiVo, e);\n            throw new BusinessException(ResponseEnum.BOT_API_CREATE_ERROR);\n        } finally {","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApiServiceImpl.java#L121-L157","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the appId exists for this uid (query app_mst) and pick a valid app in the publish dialog.","Verify the botId exists and belongs to uid+spaceId before calling createBotApi.","Refresh the client's app/bot lists to remove stale deleted entities.","If the app belongs to another user, create/select an app under the current account."],"exampleFix":"// before\npublishApiService.createBotApi(new CreateBotApiVo(botId, someAppId), request, uid, spaceId);\n// after\nAppMst app = appMstService.getByAppId(uid, someAppId);\nChatBotBase bot = chatBotDataService.findOne(uid, botId, spaceId);\nif (bot == null || app == null) {\n    throw new BusinessException(ResponseEnum.USER_APP_ID_NOT_EXISTE); // same as server; pre-validate\n}\npublishApiService.createBotApi(vo, request, uid, spaceId);","handlingStrategy":"validation","validationCode":"ChatBotBase bot = chatBotDataService.findOne(uid, botId, spaceId);\nAppMst app = appMstService.getByAppId(uid, appId);\nif (bot == null || app == null) { throw new BusinessException(ResponseEnum.USER_APP_ID_NOT_EXISTE); }","typeGuard":"boolean publishable = botBase != null && appMst != null;","tryCatchPattern":"try { publishApiService.createBotApi(vo, request, uid, spaceId); }\ncatch (BusinessException e) { if (e.getCode() == ResponseEnum.USER_APP_ID_NOT_EXISTE) { refreshListsAndPromptReselection(); } else throw e; }","preventionTips":["Load appId options server-side scoped to the current uid so foreign apps can't be submitted.","Refresh bot/app selections after any delete operation.","Validate botId/appId ownership in the controller layer too."],"tags":["not-found","validation","api-publish"],"backgroundTag":"entity-not-found","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}