{"record":{"id":"c8a7fd7c015eeb06","repo":"iflytek/astron-agent","slug":"bot-not-exists","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/controller/chat/ChatListController.java","lineNumber":135,"sourceCode":"    private void setDefaultChatListName(ChatListCreateRequest payload) {\n        if (StringUtils.isBlank(payload.getChatListName())) {\n            if (payload.getShowType() != null && payload.getShowType() == 2) {\n                payload.setChatListName(\"New Chat\");\n            } else {\n                payload.setChatListName(\"New Chat Window\");\n            }\n        }\n    }\n\n    /**\n     * Validate if bot ID is valid\n     *\n     * @param botId Bot ID to be validated\n     * @return Returns original value if botId is valid, otherwise throws exception\n     */\n    private Integer validateBotId(Integer botId) {\n        if (botId == null || botId == 0) {\n            throw new BusinessException(ResponseEnum.BOT_NOT_EXISTS);\n        }\n        return botId;\n    }\n\n    /**\n     * Validate bot permissions\n     *\n     * @param botId Bot ID\n     * @param uid User ID\n     */\n    private void validateBotPermissions(Integer botId, String uid) {\n        ChatBotMarket chatBotMarket = chatBotDataService.findMarketBotByBotId(botId);\n\n        if (chatBotMarket != null) {\n            validateMarketBotPermissions(chatBotMarket, uid);\n        } else {\n            validatePrivateBotPermissions(botId, uid);\n        }","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/controller/chat/ChatListController.java#L117-L153","documentation":"BOT_NOT_EXISTS is thrown by validateBotId when a botId parameter is null or 0, indicating no valid bot was specified. Callers (e.g. the botId endpoint) run this validation before using the id, since bot 0/null never corresponds to a real bot.","triggerScenarios":"Calling a chat-list endpoint that takes botId without supplying botId, or explicitly passing botId=0; default/uninitialized integer field serialized as 0; query parameter omitted from the request.","commonSituations":"Clients initializing botId to 0 as a 'no bot' sentinel and sending it anyway; missing query param in a GET; a flow where the bot was never created so the id stayed 0.","solutions":["Pass a real, positive botId obtained from bot creation/list APIs","Do not send botId when you mean 'no bot' — omit it or use the endpoint variant that supports absence","Guard client-side: if botId is 0/null, skip the call or create the bot first","Fix default initialization so unset bots don't serialize as 0"],"exampleFix":"// before\nconst botId = 0; await getChatList({ botId });\n// after\nif (!botId) throw new Error('create/select a bot first');\nawait getChatList({ botId: realBotId });","handlingStrategy":"validation","validationCode":"if (!botId || botId === 0) throw new Error('a valid botId (>0) is required');","typeGuard":"const hasBot = (id) => typeof id === 'number' && Number.isInteger(id) && id > 0;","tryCatchPattern":"try { await api({ botId }); } catch (e) { if (e.code === 'BOT_NOT_EXISTS') { await createOrSelectBot(); } else throw e; }","preventionTips":["Treat botId 0 as 'unset' and block submission, not as a valid value","Obtain botId from the bot creation/list API response","Never default botId fields to 0 in client state","Validate bot existence before building chat lists on it"],"tags":["validation","bot","missing-argument"],"backgroundTag":"missing-required-argument","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"}