iflytek/astron-agent · error · BusinessException

BOT_CHAIN_SUBMIT_ERROR

BOT_CHAIN_SUBMIT_ERROR

Error message

BOT_CHAIN_SUBMIT_ERROR

What it means

BOT_CHAIN_SUBMIT_ERROR is thrown by publishMcp when no UserLangChainInfo row (the bot's workflow/chain protocol record) can be found for the botId. The service requires the latest chain record to derive workflow context before publishing to MCP; without it the publish is aborted.

Solutions

  1. Open the bot in the workflow editor and save/submit the workflow so a UserLangChainInfo row is created, then retry publish.
  2. Verify user_lang_chain_info has a row for this bot_id: SELECT * FROM user_lang_chain_info WHERE bot_id=? ORDER BY create_time DESC LIMIT 1.
  3. If the bot is not a workflow bot, use the correct publish channel for its type instead of MCP.
  4. Restore missing chain rows from backup/migration if data loss occurred.

Example fix

// before
mcpService.publishMcp(request, uid, spaceId); // bot has no saved workflow
// after
UserLangChainInfo chain = userLangChainDataService.findLatestByBotId(botId);
if (chain == null) {
    workflowService.saveAndSubmitChain(botId, draftChain); // ensure workflow exists first
}
mcpService.publishMcp(request, uid, spaceId);
Defensive patterns

Strategy: validation

Validate before calling

UserLangChainInfo chain = userLangChainInfoMapper.selectOne(new QueryWrapper<UserLangChainInfo>()
    .eq("bot_id", botId).orderByDesc("create_time").last("LIMIT 1"));
if (chain == null) { throw new BusinessException(ResponseEnum.BOT_CHAIN_SUBMIT_ERROR); }

Type guard

boolean hasWorkflow = chainInfo != null;

Try / catch

try { mcpService.publishMcp(request, uid, spaceId); }
catch (BusinessException e) { if (e.getCode() == ResponseEnum.BOT_CHAIN_SUBMIT_ERROR) { promptUserToSaveWorkflow(); } else throw e; }

Prevention

When it happens

Trigger: Publishing an MCP server for a bot that was never saved/submitted as a workflow (no user_lang_chain_info row), or whose chain records were deleted; ordering by create_time DESC LIMIT 1 returns null.

Common situations: Publishing a plain chat/Q&A bot (non-workflow) through the MCP channel; DB cleanup or migration removed chain rows; bot created via import without completing workflow submission.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

                request.getBotId(), request.getServerName(), currentUid, spaceId);

        Integer botId = request.getBotId();

        // 1. Permission check
        int hasPermission = chatBotBaseMapper.checkBotPermission(botId, currentUid, spaceId);
        if (hasPermission == 0) {
            throw new BusinessException(ResponseEnum.BOT_NOT_EXISTS);
        }

        // 2. Check if workflow protocol exists
        UserLangChainInfo chainInfo = userLangChainInfoMapper.selectOne(
                new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<UserLangChainInfo>()
                        .eq("bot_id", botId)
                        .orderByDesc("create_time")
                        .last("LIMIT 1"));
        if (chainInfo == null) {
            log.info("Bot workflow protocol not found: uid={}, botId={}", currentUid, botId);
            throw new BusinessException(ResponseEnum.BOT_CHAIN_SUBMIT_ERROR);
        }

        // 3. Content moderation (simplified here, should call moderation service in production)
        // TODO: Call moderation service to check text and images
        // String allText = request.getServerName() + request.getDescription() + request.getContent();

        // 4. Get version name first (without releasing yet)
        String versionName = getVersionName(botId, currentUid, spaceId);

        // 5. Check if MCP with same version already exists
        // int existCount = mcpDataMapper.checkMcpExists(botId, versionName);
        // if (existCount > 0) {
        // throw new BusinessException("MCP with this version already exists, please do not republish");
        // }

        // 6. Register MCP and get server URL (corresponds to maasUtil.registerMcp in original project)
        String serverUrl = registerMcpAndGetUrl(botId, request, versionName, currentUid, spaceId);

View on GitHub (pinned to 5e758547a8)