apache/dolphinscheduler · error · ServiceException

50004

50004

Error message

workflow definition {0} workflow version {1} not online

What it means

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.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java:477

    @Transactional
    @Override
    public void onlineSchedulerByWorkflowCode(Long workflowDefinitionCode) {
        Schedule schedule = scheduleDao.queryByWorkflowDefinitionCode(workflowDefinitionCode);
        doOnlineScheduler(schedule);
    }

    private void doOnlineScheduler(Schedule schedule) {
        if (schedule == null) {
            return;
        }
        if (ReleaseState.ONLINE.equals(schedule.getReleaseState())) {
            log.debug("The schedule is already online, scheduleId:{}.", schedule.getId());
            return;
        }
        WorkflowDefinition workflowDefinition =
                workflowDefinitionDao.queryByCode(schedule.getWorkflowDefinitionCode()).orElse(null);
        if (!ReleaseState.ONLINE.equals(workflowDefinition.getReleaseState())) {
            throw new ServiceException(Status.WORKFLOW_DEFINITION_NOT_RELEASE, workflowDefinition.getName());
        }

        schedule.setReleaseState(ReleaseState.ONLINE);
        schedule.setUpdateTime(new Date());
        scheduleDao.updateById(schedule);

        Project project = projectDao.queryByCode(workflowDefinition.getProjectCode());
        schedulerApi.insertOrUpdateScheduleTask(project.getId(), schedule);
    }

    @Transactional
    @Override
    public void offlineScheduler(User loginUser, Long projectCode, Integer schedulerId) {
        projectService.checkHasProjectWritePermissionThrowException(loginUser, projectCode);
        Schedule schedule = scheduleDao.queryById(schedulerId);
        checkScheduleBelongsToProject(schedule, projectCode);
        doOfflineScheduler(schedule);
    }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Release the workflow definition first: set its ReleaseState to ONLINE via the workflow definition release API, then online the schedule.
  2. Verify the workflow definition's releaseState in t_ds_workflow_definition.
  3. If the workflow should not be online, do not online the schedule.
  4. In automation, order operations: release workflow -> online schedule.

Example fix

// before
scheduleService.onlineScheduler(loginUser, projectCode, scheduleId); // fails: workflow offline

// after
workflowDefinitionService.releaseWorkflowDefinition(loginUser, projectCode, code, ReleaseState.ONLINE);
scheduleService.onlineScheduler(loginUser, projectCode, scheduleId);
Defensive patterns

Strategy: validation

Validate before calling

WorkflowDefinition wd = workflowDefinitionDao.queryByCode(schedule.getWorkflowDefinitionCode()).orElseThrow();
if (!ReleaseState.ONLINE.equals(wd.getReleaseState())) {
    throw new IllegalStateException("Release workflow " + wd.getName() + " before onlining its schedule");
}

Try / catch

try {
    schedulerService.onlineScheduler(loginUser, projectCode, id);
} catch (ServiceException e) {
    if (e.getCode() == Status.WORKFLOW_DEFINITION_NOT_RELEASE.getCode()) {
        // release the workflow definition first, then retry once
    }
}

Prevention

When it happens

Trigger: Calling onlineScheduler / onlineSchedulerByWorkflowCode for a schedule whose workflow definition is OFFLINE (or otherwise not in ReleaseState.ONLINE).

Common situations: 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.

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 apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/83e58cc1880cc689. Report an issue: GitHub.