iflytek/astron-agent · error · BusinessException

BOT_NOT_EXIST

BOT_NOT_EXIST

Error message

BOT_NOT_EXIST

What it means

Thrown by BotMaasServiceImpl.createFromOfficialTemplate when selectByMaasId(maasId) returns null, i.e. no UserLangChainInfo row in the Astron database maps to the requested MaaS template's maasId. The template-based bot creation cannot proceed because the local workflow record backing the official template is missing, so BOT_NOT_EXIST is raised before any bot record is inserted.

Solutions

  1. Confirm the maasId in the request actually exists upstream; if it was deleted, the template must be unpublished or re-published with a new id.
  2. Run/verify the template sync job so the official MaaS template has a matching UserLangChainInfo row (check selectByMaasId for the given maasId).
  3. Check the target environment's database — staging/dev DBs often lack prod template rows.
  4. Verify maasDuplicate.getTemplateSource()/templateId routing: an exported template with null templateId wrongly falls into createFromOfficialTemplate.
  5. Retry after sync; if data was deleted, recreate the bot from a valid template id.

Example fix

// before
UserLangChainInfo userLangChainInfo = userLangChainDataService.selectByMaasId(maasId);
if (Objects.isNull(userLangChainInfo)) {
    log.info("----- Xinghuo did not find Astron workflow: {}", JSONObject.toJSONString(userLangChainInfo));
    throw new BusinessException(ResponseEnum.BOT_NOT_EXIST);
}
// after
UserLangChainInfo userLangChainInfo = userLangChainDataService.selectByMaasId(maasId);
if (Objects.isNull(userLangChainInfo)) {
    log.info("No local Astron workflow for maasId={}, templateId={}, source={}; attempting sync",
            maasId, maasDuplicate.getTemplateId(), maasDuplicate.getTemplateSource());
    userLangChainInfo = maasTemplateSyncService.syncTemplateByMaasId(maasId); // pull missing template locally
    if (Objects.isNull(userLangChainInfo)) {
        throw new BusinessException(ResponseEnum.BOT_NOT_EXIST);
    }
}
Defensive patterns

Strategy: validation

Validate before calling

// before creating from an official template, check the local mapping exists
UserLangChainInfo info = userLangChainDataService.selectByMaasId(maasDuplicate.getMaasId());
if (info == null) {
    // trigger template sync or surface a clear 'template not synchronized' error to the caller
    throw new BusinessException(ResponseEnum.BOT_NOT_EXIST);
}

Try / catch

try {
    BotInfoDto bot = botMaasService.createFromTemplate(uid, maasDuplicate, request);
} catch (BusinessException e) {
    if ("BOT_NOT_EXIST".equals(e.getCode())) {
        // maasId has no local UserLangChainInfo: verify template sync status / environment DB
        // do not retry blindly — the row must exist first
    }
}

Prevention

When it happens

Trigger: Calling createFromTemplate with an official-template request whose maasId has no corresponding row in user_lang_chain_info; the template was published upstream (Xinghuu/MaaS) but never synchronized into Astron; maasId points to a workflow deleted locally; template source misrouted to the official path instead of the exported path.

Common situations: Template synchronization job between Xinghuu and Astron hasn't run or failed, so new official templates are unknown locally; environment mismatch (template exists in prod MaaS but the target Astron DB is a fresh/staging database); the maasId in the request is stale after the upstream template was deleted; wrong templateSource causing the official branch to run for an exported template.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/workflow/impl/BotMaasServiceImpl.java:108

    private BotAIService botAIService;

    @Override
    public BotInfoDto createFromTemplate(String uid, MaasDuplicate maasDuplicate, HttpServletRequest request) {
        if (maasDuplicate.getTemplateId() != null
                || MaasTemplate.TEMPLATE_SOURCE_EXPORTED.equalsIgnoreCase(maasDuplicate.getTemplateSource())) {
            return createFromExportedTemplate(uid, maasDuplicate, request);
        }
        return createFromOfficialTemplate(uid, maasDuplicate, request);
    }

    private BotInfoDto createFromOfficialTemplate(String uid, MaasDuplicate maasDuplicate, HttpServletRequest request) {
        Long spaceId = SpaceInfoUtil.getSpaceId();
        // Create an event, consumed by /maasCopySynchronize
        Long maasId = maasDuplicate.getMaasId();
        UserLangChainInfo userLangChainInfo = userLangChainDataService.selectByMaasId(maasId);
        if (Objects.isNull(userLangChainInfo)) {
            log.info("----- Xinghuo did not find Astron workflow: {}", JSONObject.toJSONString(userLangChainInfo));
            throw new BusinessException(ResponseEnum.BOT_NOT_EXIST);
        }
        redissonClient.getBucket(MaasUtil.generatePrefix(uid, Math.toIntExact(userLangChainInfo.getId()))).set(userLangChainInfo.getId().toString(), Duration.ofSeconds(60));
        BotInfoDto botInfoDto = botService.insertWorkflowBot(uid, maasDuplicate, spaceId, BotVersionEnum.WORKFLOW.getVersion());
        // Check if response is successful
        if (botInfoDto == null) {
            throw new BusinessException(ResponseEnum.CREATE_BOT_FAILED);
        }
        // Copy a new workflow for the assistant
        JSONObject res = maasUtil.copyWorkFlow(maasDuplicate.getMaasId(), request, BotVersionEnum.WORKFLOW.getVersion(), Long.valueOf(botInfoDto.getBotId()), null);
        if (Objects.isNull(res) || res.isEmpty()) {
            throw new BusinessException(ResponseEnum.CREATE_BOT_FAILED);
        }
        Integer botId = botInfoDto.getBotId();
        botService.addMaasInfo(uid, res, botId, spaceId);
        botInfoDto.setFlowId(res.getJSONObject("data").getLong("id"));
        return botInfoDto;
    }

View on GitHub (pinned to 5e758547a8)