{"record":{"id":"c4f2b69603bb43e0","repo":"apache/dolphinscheduler","slug":"10141","errorCode":"10141","errorMessage":"The start time must not be the same as the end","messagePattern":"The start time must not be the same as the end","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java","lineNumber":556,"sourceCode":"                    ReleaseState.ONLINE.getDescp(), schedule.getId());\n            throw new ServiceException(Status.SCHEDULE_CRON_ONLINE_FORBID_UPDATE);\n        }\n\n        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());","sourceCodeStart":538,"sourceCodeEnd":574,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java#L538-L574","documentation":"updateSchedule computes DateUtils.differSec(startTime, endTime); a result of 0 means the start and end times are the same (or both null), which would make the schedule window meaningless, so SCHEDULE_START_TIME_END_TIME_SAME is thrown.","triggerScenarios":"Submitting a scheduleExpression whose startTime equals endTime, or where both are null/absent so differSec returns 0.","commonSituations":"Copy-pasting the same timestamp into both fields; clients defaulting endTime to startTime; forgetting endTime so both are null; unit tests with placeholder timestamps.","solutions":["Set endTime strictly after startTime in the scheduleExpression JSON.","Always populate both startTime and endTime (epoch millis) when updating the expression.","Client-side validate: startTime < endTime before sending.","Use a realistic long-running window, e.g. start=now, end=now+years, for open-ended schedules."],"exampleFix":"// before\n{\"startTime\":1700000000000,\"endTime\":1700000000000,\"crontab\":\"0 0 12 * * ?\"}   // same times\n\n// after\n{\"startTime\":1700000000000,\"endTime\":1730000000000,\"crontab\":\"0 0 12 * * ?\"}   // end after start","handlingStrategy":"validation","validationCode":"if (startTime == null || endTime == null || startTime.equals(endTime)) {\n    throw new IllegalArgumentException(\"startTime and endTime must be set and differ\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    schedulerService.updateSchedule(loginUser, projectCode, id, scheduleExpression, ...);\n} catch (ServiceException e) {\n    if (e.getCode() == Status.SCHEDULE_START_TIME_END_TIME_SAME.getCode()) {\n        // widen the schedule window or set an explicit endTime\n    }\n}","preventionTips":["Always set both startTime and endTime as epoch millis","Validate start < end client-side before the call","Avoid defaulting endTime to startTime in forms","Use long-running windows for open-ended schedules"],"tags":["validation","date-range","scheduler"],"backgroundTag":"invalid-date-format","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"}