apache/dolphinscheduler · error · ServiceException

START_TIME_BIGGER_THAN_END_TIME_ERROR

START_TIME_BIGGER_THAN_END_TIME_ERROR

Error message

START_TIME_BIGGER_THAN_END_TIME_ERROR: start time must be smaller than end time

What it means

START_TIME_BIGGER_THAN_END_TIME_ERROR is thrown by insertSchedule when ScheduleParam.startTime is strictly after ScheduleParam.endTime. A schedule window must run forward in time; DolphinScheduler rejects inverted ranges before creating the quartz schedule. Note the check uses raw getTime(), so it runs after the equality check (differSec == 0).

Source

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

        Schedule scheduleObj = new Schedule();
        Date now = new Date();

        tenantExistValidator.validate(tenantCode);

        scheduleObj.setTenantCode(tenantCode);
        scheduleObj.setProjectName(project.getName());
        scheduleObj.setWorkflowDefinitionCode(workflowDefinitionCode);
        scheduleObj.setWorkflowDefinitionName(workflowDefinition.getName());

        ScheduleParam scheduleParam = JSONUtils.parseObject(schedule, ScheduleParam.class);
        if (DateUtils.differSec(scheduleParam.getStartTime(), scheduleParam.getEndTime()) == 0) {
            log.warn("The start time must not be the same as the end or time can not be null.");
            throw new ServiceException(Status.SCHEDULE_START_TIME_END_TIME_SAME);
        }
        if (scheduleParam.getStartTime().getTime() > scheduleParam.getEndTime().getTime()) {
            log.warn("The start time must smaller than end time");
            throw new ServiceException(Status.START_TIME_BIGGER_THAN_END_TIME_ERROR);
        }

        scheduleObj.setStartTime(scheduleParam.getStartTime());
        scheduleObj.setEndTime(scheduleParam.getEndTime());
        if (!CronUtils.isValidExpression(scheduleParam.getCrontab())) {
            log.error("Schedule crontab verify failure, crontab:{}.", scheduleParam.getCrontab());
            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, scheduleParam.getCrontab());
        }
        scheduleObj.setCrontab(scheduleParam.getCrontab());
        validateMissedFirePolicy(scheduleParam);
        scheduleObj.setMissedFirePolicy(scheduleParam.getMissedFirePolicy());
        scheduleObj.setTimezoneId(scheduleParam.getTimezoneId());
        scheduleObj.setWarningType(warningType);
        scheduleObj.setWarningGroupId(warningGroupId);
        scheduleObj.setFailureStrategy(failureStrategy);
        scheduleObj.setCreateTime(now);
        scheduleObj.setUpdateTime(now);
        scheduleObj.setUserId(loginUser.getId());

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Swap the values so startTime <= endTime, keeping them at least one second apart.
  2. Pre-validate: parse both dates and assert start.getTime() < end.getTime() before invoking the API.
  3. Check whether a timezoneId/timezone conversion is shifting one timestamp; express both in the same zone.

Example fix

// before
{"startTime":"2026-09-05 00:00:00","endTime":"2026-09-01 00:00:00"}
// after
{"startTime":"2026-09-01 00:00:00","endTime":"2026-09-05 00:00:00"}
Defensive patterns

Strategy: validation

Validate before calling

Date start = sdf.parse(param.getStartTime());
Date end = sdf.parse(param.getEndTime());
if (!start.before(end)) {
    throw new IllegalArgumentException("startTime must be earlier than endTime");
}

Try / catch

try { schedulerService.insertSchedule(...); } catch (ServiceException e) { if (e.getCode() == Status.START_TIME_BIGGER_THAN_END_TIME_ERROR) { /* swap or correct the range */ } }

Prevention

When it happens

Trigger: POST /projects/{projectCode}/schedule with a schedule JSON such as {"startTime":"2026-09-05 00:00:00","endTime":"2026-09-01 00:00:00"}; same happens in updateSchedule when the new expression's times are inverted.

Common situations: Swapped date fields in a script or curl command; copy-paste of a template with a later start than end; timezone offsets applied to only one of the two fields; UI date pickers that allow arbitrary ordering.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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