{"record":{"id":"83e58cc1880cc689","repo":"apache/dolphinscheduler","slug":"50004","errorCode":"50004","errorMessage":"workflow definition {0} workflow version {1} not online","messagePattern":"workflow definition (.+?) workflow version (.+?) not online","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java","lineNumber":477,"sourceCode":"    @Transactional\n    @Override\n    public void onlineSchedulerByWorkflowCode(Long workflowDefinitionCode) {\n        Schedule schedule = scheduleDao.queryByWorkflowDefinitionCode(workflowDefinitionCode);\n        doOnlineScheduler(schedule);\n    }\n\n    private void doOnlineScheduler(Schedule schedule) {\n        if (schedule == null) {\n            return;\n        }\n        if (ReleaseState.ONLINE.equals(schedule.getReleaseState())) {\n            log.debug(\"The schedule is already online, scheduleId:{}.\", schedule.getId());\n            return;\n        }\n        WorkflowDefinition workflowDefinition =\n                workflowDefinitionDao.queryByCode(schedule.getWorkflowDefinitionCode()).orElse(null);\n        if (!ReleaseState.ONLINE.equals(workflowDefinition.getReleaseState())) {\n            throw new ServiceException(Status.WORKFLOW_DEFINITION_NOT_RELEASE, workflowDefinition.getName());\n        }\n\n        schedule.setReleaseState(ReleaseState.ONLINE);\n        schedule.setUpdateTime(new Date());\n        scheduleDao.updateById(schedule);\n\n        Project project = projectDao.queryByCode(workflowDefinition.getProjectCode());\n        schedulerApi.insertOrUpdateScheduleTask(project.getId(), schedule);\n    }\n\n    @Transactional\n    @Override\n    public void offlineScheduler(User loginUser, Long projectCode, Integer schedulerId) {\n        projectService.checkHasProjectWritePermissionThrowException(loginUser, projectCode);\n        Schedule schedule = scheduleDao.queryById(schedulerId);\n        checkScheduleBelongsToProject(schedule, projectCode);\n        doOfflineScheduler(schedule);\n    }","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java#L459-L495","documentation":"doOnlineScheduler refuses to put a schedule ONLINE when its workflow definition's release state is not ONLINE (WORKFLOW_DEFINITION_NOT_RELEASE). A schedule can only be activated when the workflow it schedules is itself published.","triggerScenarios":"Calling onlineScheduler / onlineSchedulerByWorkflowCode for a schedule whose workflow definition is OFFLINE (or otherwise not in ReleaseState.ONLINE).","commonSituations":"Users trying to enable a schedule for a draft/unpublished workflow; workflow was taken offline by someone else; batch scripts online schedules without first releasing the workflows.","solutions":["Release the workflow definition first: set its ReleaseState to ONLINE via the workflow definition release API, then online the schedule.","Verify the workflow definition's releaseState in t_ds_workflow_definition.","If the workflow should not be online, do not online the schedule.","In automation, order operations: release workflow -> online schedule."],"exampleFix":"// before\nscheduleService.onlineScheduler(loginUser, projectCode, scheduleId); // fails: workflow offline\n\n// after\nworkflowDefinitionService.releaseWorkflowDefinition(loginUser, projectCode, code, ReleaseState.ONLINE);\nscheduleService.onlineScheduler(loginUser, projectCode, scheduleId);","handlingStrategy":"validation","validationCode":"WorkflowDefinition wd = workflowDefinitionDao.queryByCode(schedule.getWorkflowDefinitionCode()).orElseThrow();\nif (!ReleaseState.ONLINE.equals(wd.getReleaseState())) {\n    throw new IllegalStateException(\"Release workflow \" + wd.getName() + \" before onlining its schedule\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    schedulerService.onlineScheduler(loginUser, projectCode, id);\n} catch (ServiceException e) {\n    if (e.getCode() == Status.WORKFLOW_DEFINITION_NOT_RELEASE.getCode()) {\n        // release the workflow definition first, then retry once\n    }\n}","preventionTips":["Order automation: release workflow ONLINE, then online its schedule","Check ReleaseState before onlining schedules","Monitor for workflows taken offline by teammates","Surface workflow release state in your scheduling dashboards"],"tags":["release-state","workflow","scheduler","state-machine"],"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"}