{"record":{"id":"83fea50543d1ab8e","repo":"apache/dolphinscheduler","slug":"schedule-start-time-end-time-same","errorCode":"SCHEDULE_START_TIME_END_TIME_SAME","errorMessage":"SCHEDULE_START_TIME_END_TIME_SAME: start time must not be the same as end time","messagePattern":"SCHEDULE_START_TIME_END_TIME_SAME: start time must not be the same as end time","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java","lineNumber":159,"sourceCode":"                    workflowDefinitionCode);\n            throw new ServiceException(Status.SCHEDULE_ALREADY_EXISTS, workflowDefinitionCode,\n                    scheduleExists.getId());\n        }\n\n        Schedule scheduleObj = new Schedule();\n        Date now = new Date();\n\n        tenantExistValidator.validate(tenantCode);\n\n        scheduleObj.setTenantCode(tenantCode);\n        scheduleObj.setProjectName(project.getName());\n        scheduleObj.setWorkflowDefinitionCode(workflowDefinitionCode);\n        scheduleObj.setWorkflowDefinitionName(workflowDefinition.getName());\n\n        ScheduleParam scheduleParam = JSONUtils.parseObject(schedule, ScheduleParam.class);\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        scheduleObj.setStartTime(scheduleParam.getStartTime());\n        scheduleObj.setEndTime(scheduleParam.getEndTime());\n        if (!CronUtils.isValidExpression(scheduleParam.getCrontab())) {\n            log.error(\"Schedule crontab verify failure, crontab:{}.\", scheduleParam.getCrontab());\n            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, scheduleParam.getCrontab());\n        }\n        scheduleObj.setCrontab(scheduleParam.getCrontab());\n        validateMissedFirePolicy(scheduleParam);\n        scheduleObj.setMissedFirePolicy(scheduleParam.getMissedFirePolicy());\n        scheduleObj.setTimezoneId(scheduleParam.getTimezoneId());\n        scheduleObj.setWarningType(warningType);\n        scheduleObj.setWarningGroupId(warningGroupId);","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java#L141-L177","documentation":"DolphinScheduler throws SCHEDULE_START_TIME_END_TIME_SAME when a schedule is created whose start time and end time resolve to the same second (DateUtils.differSec(...) == 0). A schedule with zero duration is meaningless for the quartz-based scheduler, so insertSchedule rejects it before persisting. The check also implicitly covers null start/end times, which fail parsing/comparison.","triggerScenarios":"Calling POST /projects/{projectCode}/schedule (or SchedulerService.insertSchedule) with a JSON `schedule` body where ScheduleParam.startTime equals Schedule.endTime, e.g. {\"startTime\":\"2026-09-01 10:00:00\",\"endTime\":\"2026-09-01 10:00:00\",\"crontab\":\"0 0 0 * * ? *\"}.","commonSituations":"UI form defaults that prefill identical start/end timestamps; API scripts that template the same value into both fields; timezone conversion collapsing distinct local times to the same instant; forgetting to update endTime after editing startTime.","solutions":["Provide an endTime strictly later than startTime (at least 1 second apart) in the schedule JSON.","Validate the parsed ScheduleParam client-side before calling the API: if (DateUtils.differSec(start, end) == 0) reject.","If null times caused the parse to yield equal values, include explicit, non-null startTime and endTime strings in 'yyyy-MM-dd HH:mm:ss' format."],"exampleFix":"// before\nString schedule = \"{\\\"startTime\\\":\\\"2026-09-01 10:00:00\\\",\\\"endTime\\\":\\\"2026-09-01 10:00:00\\\",\\\"crontab\\\":\\\"0 0 0 * * ? *\\\"}\";\n// after\nString schedule = \"{\\\"startTime\\\":\\\"2026-09-01 10:00:00\\\",\\\"endTime\\\":\\\"2026-09-01 11:00:00\\\",\\\"crontab\\\":\\\"0 0 0 * * ? *\\\"}\";","handlingStrategy":"validation","validationCode":"Date start = sdf.parse(param.getStartTime());\nDate end = sdf.parse(param.getEndTime());\nif (start == null || end == null || DateUtils.differSec(start, end) == 0) {\n    throw new IllegalArgumentException(\"startTime and endTime must differ by at least 1 second\");\n}","typeGuard":null,"tryCatchPattern":"try { schedulerService.insertSchedule(...); } catch (ServiceException e) { if (e.getCode() == Status.SCHEDULE_START_TIME_END_TIME_SAME) { /* fix times and retry or surface to user */ } }","preventionTips":["Always set endTime after startTime in schedule forms; validate before submit","Include explicit 'yyyy-MM-dd HH:mm:ss' timestamps, never rely on defaults","Unit-test schedule payloads with a differSec(start,end) > 0 assertion"],"tags":["scheduler","validation","date-range"],"backgroundTag":"invalid-argument-value","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"}