iflytek/astron-agent · error · BusinessException

BOT_TYPE_NOT_SUPPORT

BOT_TYPE_NOT_SUPPORT

Error message

BOT_TYPE_NOT_SUPPORT

What it means

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.

Solutions

  1. Convert/recreate the bot as a WORKFLOW-type bot, then publish its API.
  2. Use the publish channel appropriate for the bot's type (the UI/API usually offers alternatives for non-workflow bots).
  3. If workflow bots are wrongly flagged, check bot_base.version values against BotVersionEnum.WORKFLOW.getVersion() for a version-enum mismatch after upgrades.
  4. Filter the publish UI to only offer API publishing for workflow bots.

Example fix

// before
publishApiService.createBotApi(vo, request, uid, spaceId); // bot is non-workflow
// after
ChatBotBase bot = chatBotDataService.findOne(uid, vo.getBotId(), spaceId);
if (bot.getVersion() != BotVersionEnum.WORKFLOW.getVersion()) {
    throw new BusinessException(ResponseEnum.BOT_TYPE_NOT_SUPPORT); // pre-check with clear UX
}
publishApiService.createBotApi(vo, request, uid, spaceId);
Defensive patterns

Strategy: type-guard

Validate before calling

List<Integer> supported = List.of(BotVersionEnum.WORKFLOW.getVersion());
if (!supported.contains(bot.getVersion())) { throw new BusinessException(ResponseEnum.BOT_TYPE_NOT_SUPPORT); }

Type guard

boolean isWorkflowBot = bot.getVersion() == BotVersionEnum.WORKFLOW.getVersion();

Try / catch

try { publishApiService.createBotApi(vo, request, uid, spaceId); }
catch (BusinessException e) { if (e.getCode() == ResponseEnum.BOT_TYPE_NOT_SUPPORT) { showUnsupportedBotTypeMessage(); } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/75027d45f1da90be. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApiServiceImpl.java:150

    @Transactional(rollbackFor = Exception.class)
    public BotApiInfoDTO createBotApi(CreateBotApiVo createBotApiVo, HttpServletRequest request, String uid, Long spaceId) {
        String uuid = UUID.randomUUID().toString();

        ChatBotBase botBase = chatBotDataService.findOne(uid, createBotApiVo.getBotId(), spaceId);
        AppMst appMst = appMstService.getByAppId(uid, createBotApiVo.getAppId());
        if (Objects.isNull(botBase) || Objects.isNull(appMst)) {
            throw new BusinessException(ResponseEnum.USER_APP_ID_NOT_EXISTE);
        }

        if (!redisUtil.tryLock(PUBLISH_API + uid, 3000, uuid)) {
            throw new BusinessException(ResponseEnum.BOT_API_CREATE_LIMIT_ERROR);
        }
        try {
            List<Integer> maasSupportedVersions = List.of(BotVersionEnum.WORKFLOW.getVersion());
            if (maasSupportedVersions.contains(botBase.getVersion())) {
                return createMaasApi(uid, appMst, botBase, spaceId, request);
            } else {
                throw new BusinessException(ResponseEnum.BOT_TYPE_NOT_SUPPORT);
            }
        } catch (BusinessException e) {
            throw e;
        } catch (Exception e) {
            log.error("PublishApiServiceImpl.createBotApi : create Bot api error, request: {}", createBotApiVo, e);
            throw new BusinessException(ResponseEnum.BOT_API_CREATE_ERROR);
        } finally {
            redisUtil.unlock(PUBLISH_API + uid, uuid);
        }

    }

    @Override
    public BotApiInfoDTO getApiInfo(Long botId) {
        String uid = RequestContextUtil.getUID();
        ChatBotBase botBase = chatBotDataService.findOne(uid, botId);
        if (Objects.isNull(botBase)) {
            throw new BusinessException(ResponseEnum.BOT_NOT_EXISTS);

View on GitHub (pinned to 5e758547a8)