{"record":{"id":"75027d45f1da90be","repo":"iflytek/astron-agent","slug":"bot-type-not-support","errorCode":"BOT_TYPE_NOT_SUPPORT","errorMessage":"BOT_TYPE_NOT_SUPPORT","messagePattern":"BOT_TYPE_NOT_SUPPORT","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":150,"sourceCode":"    @Transactional(rollbackFor = Exception.class)\n    public BotApiInfoDTO createBotApi(CreateBotApiVo createBotApiVo, HttpServletRequest request, String uid, Long spaceId) {\n        String uuid = UUID.randomUUID().toString();\n\n        ChatBotBase botBase = chatBotDataService.findOne(uid, createBotApiVo.getBotId(), spaceId);\n        AppMst appMst = appMstService.getByAppId(uid, createBotApiVo.getAppId());\n        if (Objects.isNull(botBase) || Objects.isNull(appMst)) {\n            throw new BusinessException(ResponseEnum.USER_APP_ID_NOT_EXISTE);\n        }\n\n        if (!redisUtil.tryLock(PUBLISH_API + uid, 3000, uuid)) {\n            throw new BusinessException(ResponseEnum.BOT_API_CREATE_LIMIT_ERROR);\n        }\n        try {\n            List<Integer> maasSupportedVersions = List.of(BotVersionEnum.WORKFLOW.getVersion());\n            if (maasSupportedVersions.contains(botBase.getVersion())) {\n                return createMaasApi(uid, appMst, botBase, spaceId, request);\n            } else {\n                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);","sourceCodeStart":132,"sourceCodeEnd":168,"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#L132-L168","documentation":"BOT_TYPE_NOT_SUPPORT is thrown by createBotApi when the bot's version (botBase.getVersion()) is not in the MaaS-supported list, currently only BotVersionEnum.WORKFLOW. Only workflow bots can be published as APIs through this path; any other bot type reaches the else branch and is rejected.","triggerScenarios":"createBotApi invoked for a bot whose version enum is not WORKFLOW (e.g. a legacy/assistant-type bot), so maasSupportedVersions.contains(botBase.getVersion()) is false.","commonSituations":"Publishing an old-style chatbot via the API-publish channel after the platform narrowed support to workflow bots; bot created before a version migration; client doesn't filter bot types in the publish UI.","solutions":["Convert/recreate the bot as a WORKFLOW-type bot, then publish its API.","Use the publish channel appropriate for the bot's type (the UI/API usually offers alternatives for non-workflow bots).","If workflow bots are wrongly flagged, check bot_base.version values against BotVersionEnum.WORKFLOW.getVersion() for a version-enum mismatch after upgrades.","Filter the publish UI to only offer API publishing for workflow bots."],"exampleFix":"// before\npublishApiService.createBotApi(vo, request, uid, spaceId); // bot is non-workflow\n// after\nChatBotBase bot = chatBotDataService.findOne(uid, vo.getBotId(), spaceId);\nif (bot.getVersion() != BotVersionEnum.WORKFLOW.getVersion()) {\n    throw new BusinessException(ResponseEnum.BOT_TYPE_NOT_SUPPORT); // pre-check with clear UX\n}\npublishApiService.createBotApi(vo, request, uid, spaceId);","handlingStrategy":"type-guard","validationCode":"List<Integer> supported = List.of(BotVersionEnum.WORKFLOW.getVersion());\nif (!supported.contains(bot.getVersion())) { throw new BusinessException(ResponseEnum.BOT_TYPE_NOT_SUPPORT); }","typeGuard":"boolean isWorkflowBot = bot.getVersion() == BotVersionEnum.WORKFLOW.getVersion();","tryCatchPattern":"try { publishApiService.createBotApi(vo, request, uid, spaceId); }\ncatch (BusinessException e) { if (e.getCode() == ResponseEnum.BOT_TYPE_NOT_SUPPORT) { showUnsupportedBotTypeMessage(); } else throw e; }","preventionTips":["Only expose API publishing for workflow bots in the UI.","Keep BotVersionEnum values stable across upgrades; migrate legacy bots explicitly.","Surface bot type early in publish flows to avoid late failures."],"tags":["unsupported","bot-type","api-publish"],"backgroundTag":"unsupported-operation","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}