iflytek/astron-agent · error · BusinessException

WORKFLOW_VERSION_PUBLISH_FAILED

WORKFLOW_VERSION_PUBLISH_FAILED

Error message

WORKFLOW_VERSION_PUBLISH_FAILED

What it means

WORKFLOW_VERSION_PUBLISH_FAILED thrown by the bot publish event listener when a workflow bot has no flowId. Publishing a workflow version requires a valid flowId; if findFlowIdByBotId returns null/empty the publish cannot proceed.

Solutions

  1. Ensure the bot's workflow draft exists and is saved (flowId persisted) before publishing
  2. Check userLangChainData table has a row mapping botId to flowId
  3. Re-create the workflow for the bot, then retry publish
  4. Fix data by inserting the correct flowId mapping for the botId

Example fix

// before
publishBot(botId); // workflow never saved
// after
const flowId = getFlowId(botId);
if (flowId) publishBot(botId); else saveWorkflowDraft(botId);
Defensive patterns

Strategy: validation

Validate before calling

const flowId = await getFlowId(botId); if (!flowId) throw new Error('bot has no workflow; save draft first'); await publishBot(botId);

Prevention

When it happens

Trigger: Bot publish status-change event for a bot typed as workflow whose workflow data has no associated flowId (bot created as workflow but workflow draft never saved, or data row missing).

Common situations: Bots migrated/imported without workflow linkage; draft deleted before publishing; manual DB edits; race between workflow creation and publish.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/listener/WorkflowBotPublishListener.java:65

            ChatBotBase botBase = chatBotBaseMapper.selectById(event.getBotId());
            if (botBase == null) {
                log.warn("Bot not found, skipping workflow publish handling: botId={}", event.getBotId());
                return;
            }

            // 2. Check if it's a workflow bot
            if (!BotTypeEnum.isWorkflowBot(botBase.getVersion()) && !BotTypeEnum.isTalkBot(botBase.getVersion())) {
                log.debug("Not a workflow bot, skipping workflow publish handling: botId={}, version={}", event.getBotId(), botBase.getVersion());
                return;
            }

            log.info("Starting workflow bot publish handling: botId={}, version={}", event.getBotId(), botBase.getVersion());

            // 3. Get flowId for workflow-specific operations
            String flowId = userLangChainDataService.findFlowIdByBotId(event.getBotId());
            if (flowId == null || flowId.trim().isEmpty()) {
                log.error("Workflow bot missing flowId, unable to create workflow version: botId={}", event.getBotId());
                throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_PUBLISH_FAILED);
            }

            // 4. Execute workflow publish logic (including version creation and API sync)
            WorkflowReleaseResponseDto response = workflowReleaseService.publishWorkflow(
                    event.getBotId(),
                    event.getUid(),
                    event.getSpaceId(),
                    ReleaseTypeEnum.MARKET.name());

            if (response.getSuccess()) {
                log.info("Workflow bot publish and sync successful: botId={}, versionId={}, versionName={}",
                        event.getBotId(), response.getWorkflowVersionId(), response.getWorkflowVersionName());
            } else {
                log.error("Workflow bot publish failed: botId={}, error={}",
                        event.getBotId(), response.getErrorMessage());
                throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_PUBLISH_FAILED);
            }

View on GitHub (pinned to 5e758547a8)