{"record":{"id":"4624a1ede4d88ab9","repo":"apache/dolphinscheduler","slug":"80003","errorCode":"80003","errorMessage":"start time bigger than end time error","messagePattern":"start time bigger than end time error","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java","lineNumber":560,"sourceCode":"        Date now = new Date();\n\n        tenantExistValidator.validate(tenantCode);\n        schedule.setTenantCode(tenantCode);\n\n        // updateWorkflowInstance param\n        if (!StringUtils.isEmpty(scheduleExpression)) {\n            ScheduleParam scheduleParam = JSONUtils.parseObject(scheduleExpression, ScheduleParam.class);\n            if (scheduleParam == null) {\n                log.warn(\"Parameter scheduleExpression is invalid, so parse cron error.\");\n                throw new ServiceException(Status.PARSE_TO_CRON_EXPRESSION_ERROR);\n            }\n            if (DateUtils.differSec(scheduleParam.getStartTime(), scheduleParam.getEndTime()) == 0) {\n                log.warn(\"The start time must not be the same as the end or time can not be null.\");\n                throw new ServiceException(Status.SCHEDULE_START_TIME_END_TIME_SAME);\n            }\n            if (scheduleParam.getStartTime().getTime() > scheduleParam.getEndTime().getTime()) {\n                log.warn(\"The start time must smaller than end time\");\n                throw new ServiceException(Status.START_TIME_BIGGER_THAN_END_TIME_ERROR);\n            }\n\n            schedule.setStartTime(scheduleParam.getStartTime());\n            schedule.setEndTime(scheduleParam.getEndTime());\n            if (!CronUtils.isValidExpression(scheduleParam.getCrontab())) {\n                log.error(\"Schedule crontab verify failure, crontab:{}.\", scheduleParam.getCrontab());\n                throw new ServiceException(Status.SCHEDULE_CRON_CHECK_FAILED, scheduleParam.getCrontab());\n            }\n            schedule.setCrontab(scheduleParam.getCrontab());\n            validateMissedFirePolicy(scheduleParam);\n            if (scheduleParam.isMissedFirePolicySet() && scheduleParam.getMissedFirePolicy() != null) {\n                schedule.setMissedFirePolicy(scheduleParam.getMissedFirePolicy());\n            }\n            schedule.setTimezoneId(scheduleParam.getTimezoneId());\n        }\n\n        if (warningType != null) {\n            schedule.setWarningType(warningType);","sourceCodeStart":542,"sourceCodeEnd":578,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java#L542-L578","documentation":"updateSchedule enforces startTime.getTime() <= endTime.getTime(); when start is strictly after end, START_TIME_BIGGER_THAN_END_TIME_ERROR is thrown. This is a stricter sibling of the equal-times check and guards the schedule's validity window.","triggerScenarios":"Submitting a scheduleExpression where the startTime epoch-millis value is greater than the endTime value.","commonSituations":"Timezone conversion bugs shifting one timestamp; users entering a year in the wrong order; scripts generating endTime from a miscalculated offset; milliseconds vs seconds confusion making one value 1000x smaller/larger.","solutions":["Swap or correct the timestamps so startTime < endTime.","Confirm both values use the same unit (epoch milliseconds) and timezone handling.","Add a client-side check startTime < endTime before the API call.","Log/inspect the raw JSON sent to verify field ordering wasn't swapped."],"exampleFix":"// before\n{\"startTime\":1730000000000,\"endTime\":1700000000000,\"crontab\":\"0 0 12 * * ?\"}   // start > end\n\n// after\n{\"startTime\":1700000000000,\"endTime\":1730000000000,\"crontab\":\"0 0 12 * * ?\"}","handlingStrategy":"validation","validationCode":"if (scheduleParam.getStartTime().getTime() > scheduleParam.getEndTime().getTime()) {\n    throw new IllegalArgumentException(\"startTime must be before endTime\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    schedulerService.updateSchedule(loginUser, projectCode, id, scheduleExpression, ...);\n} catch (ServiceException e) {\n    if (e.getCode() == Status.START_TIME_BIGGER_THAN_END_TIME_ERROR.getCode()) {\n        // swap or correct the timestamps, then retry\n    }\n}","preventionTips":["Confirm both timestamps are epoch milliseconds (not seconds)","Check timezone conversions that can invert ordering","Assert start < end in tests generating schedule payloads","Sort timestamps programmatically instead of hand-entering them"],"tags":["validation","date-range","argument-out-of-range","scheduler"],"backgroundTag":"argument-out-of-range","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"}