{"record":{"id":"dc6dc0cdb03128c7","repo":"iflytek/astron-agent","slug":"too-many-bots","errorCode":"TOO_MANY_BOTS","errorMessage":"TOO_MANY_BOTS","messagePattern":"TOO_MANY_BOTS","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/commons/src/main/java/com/iflytek/astron/console/commons/service/bot/impl/BotServiceImpl.java","lineNumber":327,"sourceCode":"        } catch (Exception e) {\n            log.error(\"Operation failed with lock: {}\", lockKey, e);\n            throw e;\n        } finally {\n            if (lock.isHeldByCurrentThread()) {\n                lock.unlock();\n            }\n        }\n    }\n\n    private void validateBotCreation(String uid, String botName, Long spaceId) {\n        if (chatBotDataService.checkRepeatBotName(uid, null, botName, spaceId)) {\n            throw new BusinessException(ResponseEnum.DUPLICATE_BOT_NAME);\n        }\n\n        Long count = (spaceId == null) ? chatBotDataService.countBotsByUid(uid) : chatBotDataService.countBotsByUid(uid, spaceId);\n\n        if (count.intValue() > 100) {\n            throw new BusinessException(ResponseEnum.TOO_MANY_BOTS);\n        }\n    }\n\n    private void validateBotNameForUpdate(String uid, String botName, Long spaceId) {\n        if (chatBotDataService.checkRepeatBotName(uid, null, botName, spaceId)) {\n            throw new BusinessException(ResponseEnum.DUPLICATE_BOT_NAME);\n        }\n    }\n\n    private void validateBotNameForUpdate(String uid, String botName, Integer botId, Long spaceId) {\n        if (chatBotDataService.checkRepeatBotName(uid, botId, botName, spaceId)) {\n            throw new BusinessException(ResponseEnum.DUPLICATE_BOT_NAME);\n        }\n    }\n\n    private ChatBotBase createWorkflowBotBase(String uid, BotCreateForm bot, Long spaceId, Integer version) {\n        Integer botType = normalizeBotFormType(bot);\n        ChatBotBase botBase = new ChatBotBase();","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/commons/src/main/java/com/iflytek/astron/console/commons/service/bot/impl/BotServiceImpl.java#L309-L345","documentation":"BusinessException with code TOO_MANY_BOTS thrown by validateBotCreation when the user already owns more than 100 bots (counted either globally by uid or within the given spaceId). This is a platform quota limit enforced before creating another bot.","triggerScenarios":"Calling insertWorkflowBot or insertBotBasicInfo when countBotsByUid(uid[, spaceId]) returns a count > 100 — i.e. the 101st bot for that user/space.","commonSituations":"Power users or scripts that bulk-create agents; test environments accumulating bots; integrations that create a bot per workflow without cleanup; migrations importing many bots into one account.","solutions":["Delete unused bots to get under the 100-bot limit.","Reuse or update an existing bot instead of creating a new one.","Move bots into a different space if the limit is space-scoped.","If this is a legitimate enterprise need, request a quota increase by adjusting the limit (>100) in validateBotCreation."],"exampleFix":"// before: unbounded creation loop\nfor (const cfg of configs) await createBot(cfg);\n// after: check quota first\nconst count = await countMyBots();\nif (count + configs.length > 100) throw new Error('Bot quota exceeded; delete unused bots first');\nfor (const cfg of configs) await createBot(cfg);","handlingStrategy":"validation","validationCode":"const count = (await listBots()).length;\nif (count >= 100) throw new Error('Bot limit (100) reached; delete unused bots first');","typeGuard":null,"tryCatchPattern":"try { await createBot(form); } catch (e) { if (e.code === 'TOO_MANY_BOTS') { showQuotaDialog(); } else throw e; }","preventionTips":["Show remaining quota in the bot list UI","Archive/delete unused bots periodically","Batch-create scripts should count before creating","Surface the limit to users before they hit it"],"tags":["quota","limit-exceeded","business-logic","java"],"backgroundTag":"rate-limit-exceeded","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"}