{"record":{"id":"4310c64aac9a228e","repo":"iflytek/astron-agent","slug":"bot-not-exists-4310c6","errorCode":"BOT_NOT_EXISTS","errorMessage":"BOT_NOT_EXISTS","messagePattern":"BOT_NOT_EXISTS","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":168,"sourceCode":"                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 {\n            redisUtil.unlock(PUBLISH_API + uid, uuid);\n        }\n\n    }\n\n    @Override\n    public BotApiInfoDTO getApiInfo(Long botId) {\n        String uid = RequestContextUtil.getUID();\n        ChatBotBase botBase = chatBotDataService.findOne(uid, botId);\n        if (Objects.isNull(botBase)) {\n            throw new BusinessException(ResponseEnum.BOT_NOT_EXISTS);\n        }\n        ChatBotApi botApi = chatBotApiService.getOneByUidAndBotId(uid, botId);\n        if (Objects.isNull(botApi)) {\n            return new BotApiInfoDTO();\n        }\n        AppMst appMst = appMstService.getByAppId(uid, botApi.getAppId());\n        if (Objects.isNull(appMst)) {\n            throw new BusinessException(ResponseEnum.USER_APP_ID_NOT_EXISTE);\n        }\n        String serviceUrlHost = botBase.getVersion() == 1 ? botApiCbmBaseUrl : botApiMaasBaseUrl;\n        return BotApiInfoDTO.builder()\n                .botId(Math.toIntExact(botId))\n                .botName(botBase.getBotName())\n                .appName(appMst.getAppName())\n                .appId(appMst.getAppId())\n                .appKey(appMst.getAppKey())\n                .appSecret(appMst.getAppSecret())\n                .serviceUrl(serviceUrlHost + botApi.getApiPath())","sourceCodeStart":150,"sourceCodeEnd":186,"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#L150-L186","documentation":"BOT_NOT_EXISTS is thrown by PublishApiServiceImpl.getApiInfo when no ChatBotBase row exists for the current user's uid and the given botId. It means the requested bot does not exist or is not visible/owned by the requesting user.","triggerScenarios":"Calling getApiInfo with a botId that has no chat_bot_base row for the authenticated uid (deleted bot, wrong uid, botId from another account/space).","commonSituations":"Stale frontend links to a deleted bot; calling with a botId copied from another environment; token belongs to a different user than the bot owner.","solutions":["Verify the bot exists for the current uid (chatBotDataService.findOne(uid, botId)).","Refresh the client's bot list and use a valid botId.","Ensure the request's auth context resolves to the bot owner's uid.","Re-create the bot if it was deleted."],"exampleFix":"// before (caller blindly calls)\nBotApiInfoDTO info = publishApiService.getApiInfo(botId);\n// after (caller validates first)\nChatBotBase bot = chatBotDataService.findOne(uid, botId);\nif (bot != null) {\n    BotApiInfoDTO info = publishApiService.getApiInfo(botId);\n} else {\n    // handle missing bot in UI\n}","handlingStrategy":"validation","validationCode":"if (chatBotDataService.findOne(uid, botId) == null) {\n    // bot missing; abort before calling getApiInfo\n    return;\n}\npublishApiService.getApiInfo(botId);","typeGuard":"boolean botExists(String uid, Long botId) {\n    return Objects.nonNull(chatBotDataService.findOne(uid, botId));\n}","tryCatchPattern":"try {\n    BotApiInfoDTO info = publishApiService.getApiInfo(botId);\n} catch (BusinessException e) {\n    if (\"BOT_NOT_EXISTS\".equals(String.valueOf(e.getCode()))) {\n        // show 'bot not found', refresh bot list\n    }\n}","preventionTips":["Refresh bot lists after deletes instead of caching botIds.","Always use the uid of the authenticated user.","Validate botId ownership before deep-linking users into bot pages."],"tags":["bot","not-found","publish-api"],"backgroundTag":"resource-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"}