{"record":{"id":"318d784fa9f3fb16","repo":"iflytek/astron-agent","slug":"bot-not-exists-318d78","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/BotPublishServiceImpl.java","lineNumber":126,"sourceCode":"        List<BotPublishInfoDto> botList = botPublishConverter.queryResultsToDtoList(queryResult.getRecords());\n\n        // 4. Build response result\n        return PageResponse.of(\n                requestDto.getPage(),\n                requestDto.getSize(),\n                queryResult.getTotal(),\n                botList);\n    }\n\n\n    @Override\n    public BotDetailResponseDto getBotDetail(Integer botId, String currentUid, Long spaceId) {\n        log.info(\"Query bot details: botId={}, uid={}, spaceId={}\", botId, currentUid, spaceId);\n\n        // 1. Permission validation and query bot basic information\n        BotPublishQueryResult queryResult = chatBotMarketMapper.selectBotDetail(botId, currentUid, spaceId);\n        if (queryResult == null) {\n            throw new BusinessException(ResponseEnum.BOT_NOT_EXISTS);\n        }\n\n        // 2. Basic information conversion (including publish channel parsing)\n        BotDetailResponseDto detailDto = botPublishConverter.queryResultToDetailDto(queryResult);\n\n        // 3. Get WeChat binding information (only query when published to WeChat)\n        if (detailDto.getPublishChannels().contains(PublishChannelEnum.WECHAT.getCode())) {\n            String[] wechatInfo = publishChannelService.getWechatInfo(currentUid, botId);\n            detailDto.setWechatRelease(Integer.valueOf(wechatInfo[0]));\n            detailDto.setWechatAppid(wechatInfo[1]);\n        } else {\n            detailDto.setWechatRelease(0);\n            detailDto.setWechatAppid(null);\n        }\n\n        // 4. Get MaaS App ID\n        String maasId = getMaasIdByBotId(botId);\n        detailDto.setMaasId(maasId);","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/BotPublishServiceImpl.java#L108-L144","documentation":"BOT_NOT_EXISTS in getBotDetail means selectBotDetail returned no row for the given botId with the caller's uid and spaceId. The mapper query doubles as permission validation, so null means the bot does not exist OR the user/space has no access — the error intentionally conflates the two to avoid leaking existence.","triggerScenarios":"Querying bot detail with a wrong/deleted botId, a bot that belongs to a different space, or a uid that is not an owner/collaborator of the bot.","commonSituations":"Stale frontend cache pointing at a deleted bot, switching spaces while an old botId is in the URL, or a user sharing a link to a bot they lack permission for.","solutions":["Verify botId exists and is not deleted","Confirm the request carries the correct spaceId and that the bot belongs to it","Check that the current uid has owner/collaborator permission on the bot","Refresh the bot list and retry with a valid id"],"exampleFix":"// before\nconst detail = await api.getBotDetail(botIdFromUrl, uid, staleSpaceId);\n// after\nconst detail = await api.getBotDetail(botIdFromUrl, uid, currentSpaceId);\nif (!detail) showToast(\"bot not found in this space\");","handlingStrategy":"try-catch","validationCode":"const bots = await api.listBots(uid, spaceId);\nif (!bots.some(b => b.id === botId)) return showError(\"bot not available in this space\");","typeGuard":"function isAccessibleBot(bots, botId) {\n    return Array.isArray(bots) && bots.some(b => b.id === botId);\n}","tryCatchPattern":"try {\n    const detail = await api.getBotDetail(botId, uid, spaceId);\n} catch (e) {\n    if (e.code === \"BOT_NOT_EXISTS\") {\n        redirectToBotList(\"bot not found or inaccessible\");\n    }\n}","preventionTips":["Refresh bot ids when switching spaces","Check bot existence in the space before deep-linking","Handle deleted bots gracefully in cached UI state"],"tags":["permission","not-found","bot"],"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"}