apache/dolphinscheduler · error · ServiceException

SCHEDULE_NOT_EXISTS

SCHEDULE_NOT_EXISTS

Error message

SCHEDULE_NOT_EXISTS: schedule {scheduleId} does not exist

What it means

SCHEDULE_NOT_EXISTS is thrown by updateSchedule when scheduleDao.queryById(id) returns null, i.e. no schedule row exists for the supplied schedule id. The update is rejected before any workflow/project permission checks. The message interpolates the requested scheduleId.

Source

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

                                   String scheduleExpression,
                                   WarningType warningType,
                                   int warningGroupId,
                                   FailureStrategy failureStrategy,
                                   Priority workflowInstancePriority,
                                   String workerGroup,
                                   String tenantCode,
                                   Long environmentCode) {

        Project project = projectDao.queryByCode(projectCode);

        projectService.checkHasProjectWritePermissionThrowException(loginUser, project);

        // check schedule exists
        Schedule schedule = scheduleDao.queryById(id);

        if (schedule == null) {
            log.error("Schedule does not exist, scheduleId:{}.", id);
            throw new ServiceException(Status.SCHEDULE_NOT_EXISTS, id);
        }

        WorkflowDefinition workflowDefinition =
                workflowDefinitionDao.queryByCode(schedule.getWorkflowDefinitionCode()).orElse(null);
        if (workflowDefinition == null || projectCode != workflowDefinition.getProjectCode()) {
            log.error("workflow definition does not exist, workflowDefinitionCode:{}.",
                    schedule.getWorkflowDefinitionCode());
            throw new ServiceException(Status.WORKFLOW_DEFINITION_NOT_EXIST,
                    String.valueOf(schedule.getWorkflowDefinitionCode()));
        }

        return updateSchedule(schedule, workflowDefinition, scheduleExpression, warningType, warningGroupId,
                failureStrategy, workflowInstancePriority, workerGroup, tenantCode, environmentCode);
    }

    /**
     * query schedule
     *

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. List existing schedules (GET /projects/{projectCode}/schedules) and use a valid id.
  2. Re-create the schedule if it was deleted (POST /projects/{projectCode}/schedule) and use the returned id.
  3. Verify you are calling the correct environment/project; ids are not portable across databases.

Example fix

// before
PUT /projects/1/schedules/9999   // id never existed
// after
PUT /projects/1/schedules/42     // id verified via GET /projects/1/schedules
Defensive patterns

Strategy: validation

Validate before calling

Schedule existing = scheduleDao.queryById(scheduleId);
if (existing == null) {
    throw new IllegalStateException("Schedule " + scheduleId + " not found; refresh id list before updating");
}

Try / catch

try { schedulerService.updateSchedule(...); } catch (ServiceException e) { if (e.getCode() == Status.SCHEDULE_NOT_EXISTS) { /* recreate schedule or refresh ids */ } }

Prevention

When it happens

Trigger: PUT /projects/{projectCode}/schedules/{id} with an id that was already deleted, an id from a different environment/database, or a typo (e.g. passing a workflow code instead of a schedule id).

Common situations: Scripts caching schedule ids that were later cleaned up; running the same cleanup twice; pointing at a dev database id while the API serves a prod database; id auto-increment mismatch after a DB restore.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/c88254d47e5fa69f. Report an issue: GitHub.