{"record":{"id":"d3fcc0530b090e04","repo":"iflytek/astron-agent","slug":"bot-status-invalid","errorCode":"BOT_STATUS_INVALID","errorMessage":"BOT_STATUS_INVALID","messagePattern":"BOT_STATUS_INVALID","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/share/impl/ShareServiceImpl.java","lineNumber":42,"sourceCode":"    @Autowired\n    private ChatBotDataService chatBotDataService;\n\n    @Autowired\n    private ShareDataService shareDataService;\n\n\n    /**\n     * Get bot status\n     *\n     * @param relatedId Related ID\n     * @return Bot status\n     * @throws BusinessException If unable to get bot status\n     */\n    @Override\n    public int getBotStatus(Long relatedId) {\n        BotDetail detail = chatBotDataService.getBotDetail(relatedId);\n        if (Objects.isNull(detail)) {\n            throw new BusinessException(ResponseEnum.BOT_STATUS_INVALID);\n        }\n        return detail.getBotStatus();\n    }\n\n    /**\n     * Generate a share key for the agent\n     *\n     * @param uid uid\n     * @param relatedType type\n     * @param relatedId id\n     * @return string\n     */\n    @Override\n    public String getShareKey(String uid, int relatedType, Long relatedId) {\n        AgentShareRecord record = shareDataService.findActiveShareRecord(uid, relatedType, relatedId);\n        if (Objects.isNull(record)) {\n            // Generate a new key and save it to the table\n            String key = Md5Util.encryption(relatedId + \"_salt_\" + uid + System.currentTimeMillis() / 1000);","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/share/impl/ShareServiceImpl.java#L24-L60","documentation":"BOT_STATUS_INVALID is thrown by ShareServiceImpl.getBotStatus when no bot detail can be found for the given relatedId. Since the status cannot be determined for a non-existent bot, the service raises this business error instead of returning a default status.","triggerScenarios":"Calling getBotStatus with a relatedId that does not correspond to any existing bot detail record (deleted bot, wrong ID, or record from another space).","commonSituations":"Sharing a link to an agent that has since been deleted; stale share URLs embedding old bot IDs; cross-space ID collisions; typos in bot identifiers.","solutions":["Verify the relatedId refers to an existing, non-deleted bot","Re-fetch the correct bot ID from the sharing source and retry","Check chatBotDataService/DB to confirm the bot detail row exists"],"exampleFix":"// before\nint status = shareService.getBotStatus(deletedBotId);\n// after\nif (chatBotDataService.getBotDetail(botId) != null) {\n    int status = shareService.getBotStatus(botId);\n}","handlingStrategy":"type-guard","validationCode":"BotDetail detail = chatBotDataService.getBotDetail(relatedId); if (detail == null) { /* abort: bot does not exist */ }","typeGuard":"boolean botExists(Long relatedId) { return relatedId != null && chatBotDataService.getBotDetail(relatedId) != null; }","tryCatchPattern":"try { int status = shareService.getBotStatus(relatedId); } catch (BusinessException e) { /* treat as bot-not-found: show 'agent unavailable' page */ }","preventionTips":["Validate bot IDs come from a trusted source (DB lookup, not URL trust)","Handle deleted bots gracefully in share links","Purge or expire share links when the bot is deleted"],"tags":["not-found","share","bot"],"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"}