{"record":{"id":"009beb561a71094a","repo":"iflytek/astron-agent","slug":"workflow-not-publish-009beb","errorCode":"WORKFLOW_NOT_PUBLISH","errorMessage":"WORKFLOW_NOT_PUBLISH","messagePattern":"WORKFLOW_NOT_PUBLISH","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java","lineNumber":4793,"sourceCode":"    public Object getModelInfo(WorkflowModelReq workflowReq) {\n        if (workflowReq == null || StringUtils.isBlank(workflowReq.getFlowId()) || workflowReq.getType() == null) {\n            return ApiResult.error(ResponseEnum.PARAM_ERROR);\n        }\n        if (!workflowReq.getType().equals(0) && !workflowReq.getType().equals(1)) {\n            return ApiResult.error(ResponseEnum.PARAM_ERROR);\n        }\n        List<WorkflowModelVo> result = new ArrayList<>();\n        Workflow workflow = getOne(Wrappers.lambdaQuery(Workflow.class).eq(Workflow::getFlowId, workflowReq.getFlowId()));\n        if (workflow == null) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST);\n        }\n        BizWorkflowData bizWorkflowData;\n        // Parse flow protocol\n        if (workflowReq.getType().equals(0)) {\n            bizWorkflowData = JSON.parseObject(workflow.getData(), BizWorkflowData.class);\n        } else {\n            if (workflow.getPublishedData() == null) {\n                throw new BusinessException(ResponseEnum.WORKFLOW_NOT_PUBLISH);\n            }\n            bizWorkflowData = JSON.parseObject(workflow.getPublishedData(), BizWorkflowData.class);\n        }\n        for (BizWorkflowNode node : bizWorkflowData.getNodes()) {\n            if (node.getId() != null && node.getId().startsWith(\"spark-llm\")) {\n                WorkflowModelVo workflowModelVo = new WorkflowModelVo();\n                workflowModelVo.setNodeId(node.getId());\n                workflowModelVo.setNodeName(node.getData().getNodeParam().getString(\"domain\"));\n                result.add(workflowModelVo);\n            }\n        }\n        return result;\n    }\n\n    public Object getNodeErrorInfo(WorkflowModelErrorReq workflowModelErrorReq) {\n        if (workflowModelErrorReq == null || StringUtils.isBlank(workflowModelErrorReq.getFlowId())) {\n            return ApiResult.error(ResponseEnum.PARAM_ERROR);\n        }","sourceCodeStart":4775,"sourceCodeEnd":4811,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java#L4775-L4811","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Publish the workflow in the console so publishedData is populated, then retry with type=1.","If you only need the draft definition, call with type=0.","Check published_data for the flowId in the DB to confirm it is null.","If publishing fails, resolve the publish-time validation errors (e.g. unconfigured nodes) and republish."],"exampleFix":"// before\nworkflowService.getWorkflowModels(WorkflowReq.builder().flowId(id).type(1).build()); // throws WORKFLOW_NOT_PUBLISH\n// after\nif (workflow.getPublishedData() == null) {\n    // fall back to draft or ask user to publish\n    return getDraftModels(id); // type=0\n}","handlingStrategy":"fallback","validationCode":"Workflow wf = getOne(...);\nboolean publishable = wf != null && StringUtils.isNotBlank(wf.getPublishedData());\nif (!publishable && req.getType() == 1) {\n    // fall back to draft (type=0) or prompt the user to publish\n}","typeGuard":null,"tryCatchPattern":"try {\n    return workflowService.getWorkflowModels(reqWithType1);\n} catch (BusinessException e) {\n    if (\"WORKFLOW_NOT_PUBLISH\".equals(e.getCode())) {\n        return workflowService.getWorkflowModels(reqWithType0); // fall back to draft\n    }\n    throw e;\n}","preventionTips":["Publish flows before querying their published definitions in automation/CI.","Check publishedData non-null before requesting type=1.","Surface an explicit 'not published yet' state in the UI.","Monitor failed publish jobs that leave publishedData null."],"tags":["workflow","publish-state","java","spring-boot"],"backgroundTag":"invalid-state-transition","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"}