iflytek/astron-agent · error · BusinessException

WORKFLOW_VERSION_PUBLISH_FAILED

WORKFLOW_VERSION_PUBLISH_FAILED

Error message

WORKFLOW_VERSION_PUBLISH_FAILED

What it means

publishWorkflow throws WORKFLOW_VERSION_PUBLISH_FAILED when the post-publish audit-result sync (updateAuditResult) returns false after the bot publish call succeeded. It signals that although publishing was attempted, recording the SUCCESS audit state failed, so the publish cannot be reported as complete.

Solutions

  1. Check whether the workflow version row for response.getWorkflowVersionId() exists and matches flowId in the DB.
  2. Retry publishWorkflow — a transient concurrent update can make updateAuditResult affect 0 rows.
  3. Refresh the workflow in the editor to get a fresh flowId/version and re-publish.
  4. Add logging inside updateAuditResult to distinguish 'row not found' from 'update failed' and fix the mismatched identifiers.

Example fix

// before
WorkflowReleaseService.publishWorkflow(staleFlowId, ...); // version already replaced
// after
workflowService.refreshDraft(flowId);           // reload latest version ids
releaseService.publishWorkflow(latestFlowId, ...);
Defensive patterns

Strategy: retry

Validate before calling

WorkflowVersion v = versionMapper.selectById(response.getWorkflowVersionId());
if (v == null || !Objects.equals(v.getFlowId(), flowId)) {
    throw new IllegalStateException("version/flow mismatch before audit update; refresh and re-publish");
}

Try / catch

try {
    releaseService.publishWorkflow(botId, flowId, uid, spaceId);
} catch (BusinessException e) {
    if ("WORKFLOW_VERSION_PUBLISH_FAILED".equals(e.getCode())) {
        retryOnceAfterReload(flowId); // reload latest version ids and re-publish
    }
}

Prevention

When it happens

Trigger: During publishWorkflow, the remote publish response comes back, but updateAuditResult(response.getWorkflowVersionId(), flowId, WorkflowConst.PublishResult.SUCCESS, uid, spaceId) returns false — typically because the version row identified by workflowVersionId/flowId no longer exists, was concurrently modified, or the update affected 0 rows.

Common situations: The workflow version was deleted by another user mid-publish; flowId/workflowVersionId mismatch after a re-publish; DB constraint or optimistic-lock failure during the audit update; publishing a stale draft that was edited concurrently in another tab.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

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

            }

            // 5. Sync to API system directly (no approval needed)
            String appId;
            if (ReleaseTypeEnum.MARKET.name().equals(publishType)) {
                appId = maasAppId;
            } else {
                appId = getAppIdByBotId(botId);
            }
            syncToApiSystem(botId, flowId, versionName, appId);

            // 6. Update audit result to success
            if (!updateAuditResult(
                    response.getWorkflowVersionId(),
                    flowId,
                    WorkflowConst.PublishResult.SUCCESS,
                    uid,
                    spaceId)) {
                throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_PUBLISH_FAILED);
            }

            log.info("Workflow bot publish and sync successful: botId={}, versionId={}, versionName={}",
                    botId, response.getWorkflowVersionId(), response.getWorkflowVersionName());

            return response;

        } catch (BusinessException e) {
            throw e;
        } catch (Exception e) {
            log.error("Workflow bot publish failed: botId={}, uid={}, spaceId={}", botId, uid, spaceId, e);
            return createErrorResponse("Publish failed: " + e.getMessage());
        }
    }

    /**
     * Get next version name for workflow release Simplified to match old project logic exactly - no
     * fallback

View on GitHub (pinned to 5e758547a8)