iflytek/astron-agent · error · BusinessException

WORKFLOW_NOT_PUBLISH

WORKFLOW_NOT_PUBLISH

Error message

WORKFLOW_NOT_PUBLISH

What it means

WORKFLOW_NOT_PUBLISH is thrown when the request asks for the published view of a workflow (workflowReq.type == 1) but the Workflow row's publishedData column is null — i.e., the flow has never been published, so there is no published protocol snapshot to parse.

Solutions

  1. Publish the workflow in the console so publishedData is populated, then retry with type=1.
  2. If you only need the draft definition, call with type=0.
  3. Check published_data for the flowId in the DB to confirm it is null.
  4. If publishing fails, resolve the publish-time validation errors (e.g. unconfigured nodes) and republish.

Example fix

// before
workflowService.getWorkflowModels(WorkflowReq.builder().flowId(id).type(1).build()); // throws WORKFLOW_NOT_PUBLISH
// after
if (workflow.getPublishedData() == null) {
    // fall back to draft or ask user to publish
    return getDraftModels(id); // type=0
}
Defensive patterns

Strategy: fallback

Validate before calling

Workflow wf = getOne(...);
boolean publishable = wf != null && StringUtils.isNotBlank(wf.getPublishedData());
if (!publishable && req.getType() == 1) {
    // fall back to draft (type=0) or prompt the user to publish
}

Try / catch

try {
    return workflowService.getWorkflowModels(reqWithType1);
} catch (BusinessException e) {
    if ("WORKFLOW_NOT_PUBLISH".equals(e.getCode())) {
        return workflowService.getWorkflowModels(reqWithType0); // fall back to draft
    }
    throw e;
}

Prevention

When it happens

Trigger: Querying workflow models with type=1 (published) for a flow that exists but has only draft data: never published, publication failed midway, or publishedData was cleared by a republish/unpublish flow bug.

Common situations: Clients defaulting to type=1 against draft-only flows; CI/tests hitting unpublished flows; environments where publishing is blocked (missing model config) so publishedData was never written; data migration that copied data but not publishedData.

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/009beb561a71094a. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java:4793

    public Object getModelInfo(WorkflowModelReq workflowReq) {
        if (workflowReq == null || StringUtils.isBlank(workflowReq.getFlowId()) || workflowReq.getType() == null) {
            return ApiResult.error(ResponseEnum.PARAM_ERROR);
        }
        if (!workflowReq.getType().equals(0) && !workflowReq.getType().equals(1)) {
            return ApiResult.error(ResponseEnum.PARAM_ERROR);
        }
        List<WorkflowModelVo> result = new ArrayList<>();
        Workflow workflow = getOne(Wrappers.lambdaQuery(Workflow.class).eq(Workflow::getFlowId, workflowReq.getFlowId()));
        if (workflow == null) {
            throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST);
        }
        BizWorkflowData bizWorkflowData;
        // Parse flow protocol
        if (workflowReq.getType().equals(0)) {
            bizWorkflowData = JSON.parseObject(workflow.getData(), BizWorkflowData.class);
        } else {
            if (workflow.getPublishedData() == null) {
                throw new BusinessException(ResponseEnum.WORKFLOW_NOT_PUBLISH);
            }
            bizWorkflowData = JSON.parseObject(workflow.getPublishedData(), BizWorkflowData.class);
        }
        for (BizWorkflowNode node : bizWorkflowData.getNodes()) {
            if (node.getId() != null && node.getId().startsWith("spark-llm")) {
                WorkflowModelVo workflowModelVo = new WorkflowModelVo();
                workflowModelVo.setNodeId(node.getId());
                workflowModelVo.setNodeName(node.getData().getNodeParam().getString("domain"));
                result.add(workflowModelVo);
            }
        }
        return result;
    }

    public Object getNodeErrorInfo(WorkflowModelErrorReq workflowModelErrorReq) {
        if (workflowModelErrorReq == null || StringUtils.isBlank(workflowModelErrorReq.getFlowId())) {
            return ApiResult.error(ResponseEnum.PARAM_ERROR);
        }

View on GitHub (pinned to 5e758547a8)