{"record":{"id":"936f46973aced927","repo":"iflytek/astron-agent","slug":"workflow-version-publish-failed","errorCode":"WORKFLOW_VERSION_PUBLISH_FAILED","errorMessage":"WORKFLOW_VERSION_PUBLISH_FAILED","messagePattern":"WORKFLOW_VERSION_PUBLISH_FAILED","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/listener/WorkflowBotPublishListener.java","lineNumber":65,"sourceCode":"            ChatBotBase botBase = chatBotBaseMapper.selectById(event.getBotId());\n            if (botBase == null) {\n                log.warn(\"Bot not found, skipping workflow publish handling: botId={}\", event.getBotId());\n                return;\n            }\n\n            // 2. Check if it's a workflow bot\n            if (!BotTypeEnum.isWorkflowBot(botBase.getVersion()) && !BotTypeEnum.isTalkBot(botBase.getVersion())) {\n                log.debug(\"Not a workflow bot, skipping workflow publish handling: botId={}, version={}\", event.getBotId(), botBase.getVersion());\n                return;\n            }\n\n            log.info(\"Starting workflow bot publish handling: botId={}, version={}\", event.getBotId(), botBase.getVersion());\n\n            // 3. Get flowId for workflow-specific operations\n            String flowId = userLangChainDataService.findFlowIdByBotId(event.getBotId());\n            if (flowId == null || flowId.trim().isEmpty()) {\n                log.error(\"Workflow bot missing flowId, unable to create workflow version: botId={}\", event.getBotId());\n                throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_PUBLISH_FAILED);\n            }\n\n            // 4. Execute workflow publish logic (including version creation and API sync)\n            WorkflowReleaseResponseDto response = workflowReleaseService.publishWorkflow(\n                    event.getBotId(),\n                    event.getUid(),\n                    event.getSpaceId(),\n                    ReleaseTypeEnum.MARKET.name());\n\n            if (response.getSuccess()) {\n                log.info(\"Workflow bot publish and sync successful: botId={}, versionId={}, versionName={}\",\n                        event.getBotId(), response.getWorkflowVersionId(), response.getWorkflowVersionName());\n            } else {\n                log.error(\"Workflow bot publish failed: botId={}, error={}\",\n                        event.getBotId(), response.getErrorMessage());\n                throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_PUBLISH_FAILED);\n            }\n","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/listener/WorkflowBotPublishListener.java#L47-L83","documentation":"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.","triggerScenarios":"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).","commonSituations":"Bots migrated/imported without workflow linkage; draft deleted before publishing; manual DB edits; race between workflow creation and publish.","solutions":["Ensure the bot's workflow draft exists and is saved (flowId persisted) before publishing","Check userLangChainData table has a row mapping botId to flowId","Re-create the workflow for the bot, then retry publish","Fix data by inserting the correct flowId mapping for the botId"],"exampleFix":"// before\npublishBot(botId); // workflow never saved\n// after\nconst flowId = getFlowId(botId);\nif (flowId) publishBot(botId); else saveWorkflowDraft(botId);","handlingStrategy":"validation","validationCode":"const flowId = await getFlowId(botId); if (!flowId) throw new Error('bot has no workflow; save draft first'); await publishBot(botId);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always save the workflow draft before publishing","Verify bot type matches workflow data presence","Monitor for bots missing flowId mappings"],"tags":["workflow","publish","missing-data"],"backgroundTag":"missing-required-config-field","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}