{"record":{"id":"fd6460fdf13d5de5","repo":"apache/dolphinscheduler","slug":"subworkflowdefinition-subworkflowdefinition-name","errorCode":null,"errorMessage":"SubWorkflowDefinition {subWorkflowDefinition name} is not online","messagePattern":"SubWorkflowDefinition (.+?) is not online","errorType":"exception","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java","lineNumber":1894,"sourceCode":"        }\n        List<TaskDefinitionLog> taskDefinitionLogs =\n                taskDefinitionLogDao.queryTaskDefineLogList(workflowTaskRelations);\n        taskDatasourcePermissionChecker.checkPermission(loginUser, taskDefinitionLogs);\n        taskSubWorkflowPermissionChecker.checkPermission(loginUser, taskDefinitionLogs);\n        // todo : check Workflow is validate\n    }\n\n    private void checkAllSubWorkflowDefinitionIsOnline(Long workflowDefinitionCode) {\n        List<Long> allSubWorkflowDefinitionCodes =\n                processService.findAllSubWorkflowDefinitionCode(workflowDefinitionCode);\n        if (CollectionUtils.isEmpty(allSubWorkflowDefinitionCodes)) {\n            return;\n        }\n        for (Long subWorkflowDefinitionCode : allSubWorkflowDefinitionCodes) {\n            WorkflowDefinition subWorkflowDefinition = workflowDefinitionDao.queryByCode(subWorkflowDefinitionCode)\n                    .orElseThrow(() -> new ServiceException(WORKFLOW_DEFINITION_NOT_EXIST, workflowDefinitionCode));\n            if (!ReleaseState.ONLINE.equals(subWorkflowDefinition.getReleaseState())) {\n                throw new ServiceException(\n                        \"SubWorkflowDefinition \" + subWorkflowDefinition.getName() + \" is not online\");\n            }\n        }\n    }\n}\n","sourceCodeStart":1876,"sourceCodeEnd":1900,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java#L1876-L1900","documentation":"Thrown when validating a workflow whose sub-workflow tasks reference a sub-workflow definition that is not in ONLINE release state. A parent workflow cannot be released/deployed while any of its dependent sub-workflows remains offline, because the scheduler could not execute them. Note the message string embeds the sub-workflow name.","triggerScenarios":"Releasing (online) a parent workflow containing SUB_PROCESS tasks whose target workflow definitions have ReleaseState != ONLINE; also occurs when a sub-workflow was taken offline after the parent referenced it.","commonSituations":"Taking sub-workflows offline for maintenance while the parent stays online; fresh environment imports where parents are online but sub-workflows import as offline; renaming/recreating a sub-workflow so the parent points at a new offline definition.","solutions":["Bring every referenced sub-workflow definition ONLINE before releasing the parent workflow.","Check each SUB_PROCESS task's target code's release state via the workflow definition API.","If a sub-workflow is intentionally retired, remove or repoint the parent's SUB_PROCESS task first.","After imports, batch-release sub-workflows (deepest dependencies first) before parents."],"exampleFix":"// before: releasing parent while sub-workflow offline\nworkflowDefinitionService.releaseWorkflowDefinition(user, projectCode, parentCode, ReleaseState.ONLINE);\n// after: ensure subs online\nfor (long subCode : allSubWorkflowDefinitionCodes) {\n    workflowDefinitionService.releaseWorkflowDefinition(user, subProjectCode, subCode, ReleaseState.ONLINE);\n}\nworkflowDefinitionService.releaseWorkflowDefinition(user, projectCode, parentCode, ReleaseState.ONLINE);","handlingStrategy":"validation","validationCode":"for (Long subCode : allSubWorkflowDefinitionCodes) {\n    WorkflowDefinition sub = workflowDefinitionDao.queryByCode(subCode).orElseThrow();\n    if (!ReleaseState.ONLINE.equals(sub.getReleaseState())) {\n        throw new IllegalStateException(\"sub-workflow \" + sub.getName() + \" must be ONLINE before releasing parent\");\n    }\n}","typeGuard":"boolean allSubWorkflowsOnline(Collection<WorkflowDefinition> subs) {\n    return subs.stream().allMatch(s -> ReleaseState.ONLINE.equals(s.getReleaseState()));\n}","tryCatchPattern":"try {\n    service.releaseWorkflowDefinition(user, projectCode, parentCode, ReleaseState.ONLINE);\n} catch (ServiceException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"is not online\")) {\n        // online the named sub-workflow, then retry\n    } else throw e;\n}","preventionTips":["Release sub-workflows before parents, in dependency order.","Do not take sub-workflows offline while a parent references them.","After imports, batch-verify release states of the whole workflow graph."],"tags":["sub-workflow","release-state","dependency","workflow-definition"],"backgroundTag":"invalid-state-transition","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}