{"record":{"id":"8501f054326c416f","repo":"flowable/flowable-engine","slug":"at-most-one-non-null-value-can-be-provided-for-tim","errorCode":null,"errorMessage":"At most one non-null value can be provided for timeDate, timeDuration, or timeCycle","messagePattern":"At most one non-null value can be provided for timeDate, timeDuration, or timeCycle","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/RescheduleTimerJobCmd.java","lineNumber":47,"sourceCode":"    private static final long serialVersionUID = 1L;\n\n    private final String timerJobId;\n    private String timeDate;\n    private String timeDuration;\n    private String timeCycle;\n    private String endDate;\n    private String calendarName;\n\n    public RescheduleTimerJobCmd(String timerJobId, String timeDate, String timeDuration, String timeCycle, String endDate, String calendarName) {\n        if (timerJobId == null) {\n            throw new FlowableIllegalArgumentException(\"The timer job id is mandatory, but 'null' has been provided.\");\n        }\n\n        int timeValues = Collections.frequency(Arrays.asList(timeDate, timeDuration, timeCycle), null);\n        if (timeValues == 0) {\n            throw new FlowableIllegalArgumentException(\"A non-null value is required for one of timeDate, timeDuration, or timeCycle\");\n        } else if (timeValues != 2) {\n            throw new FlowableIllegalArgumentException(\"At most one non-null value can be provided for timeDate, timeDuration, or timeCycle\");\n        }\n\n        if (endDate != null && timeCycle == null) {\n            throw new FlowableIllegalArgumentException(\"An end date can only be provided when rescheduling a timer using timeDuration.\");\n        }\n\n        this.timerJobId = timerJobId;\n        this.timeDate = timeDate;\n        this.timeDuration = timeDuration;\n        this.timeCycle = timeCycle;\n        this.endDate = endDate;\n        this.calendarName = calendarName;\n    }\n\n    @Override\n    public TimerJobEntity execute(CommandContext commandContext) {\n        TimerEventDefinition ted = new TimerEventDefinition();\n        ted.setTimeDate(timeDate);","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/RescheduleTimerJobCmd.java#L29-L65","documentation":"RescheduleTimerJobCmd validates that exactly one of timeDate, timeDuration, or timeCycle is non-null when rescheduling a timer job. It counts the non-null values via Collections.frequency and throws this error when more than one (or, structurally, any count other than 0 or 2 nulls — i.e. more than one non-null) is supplied. The library enforces a single scheduling expression per timer reschedule.","triggerScenarios":"Calling ManagementService.rescheduleTimeDurationJob/rescheduleTimeDateJob-style APIs (or executing RescheduleTimerJobCmd directly) with e.g. both a timeDate Date and a timeDuration String, or timeDuration plus timeCycle, non-null at the same time.","commonSituations":"Developers migrating code that sets multiple fields 'to be safe'; combining a fixed date with an ISO duration; wiring UI forms that keep previously-filled values when switching schedule modes.","solutions":["Pass exactly one of timeDate, timeDuration, or timeCycle; null out the others.","Decide the schedule mode explicitly (fixed date vs duration vs cycle) and use the corresponding reschedule method.","If an end date is needed, use timeDuration (with endDate) — not timeCycle or timeDate."],"exampleFix":"// before\nmanagementService.rescheduleJob(jobId, now, \"PT30M\", null, \"R/PT1H\");\n// after\nmanagementService.rescheduleTimeDurationJob(jobId, \"PT30M\", now);","handlingStrategy":"validation","validationCode":"int nonNull = (timeDate!=null?1:0)+(timeDuration!=null?1:0)+(timeCycle!=null?1:0);\nif (nonNull != 1) throw new IllegalArgumentException(\"Provide exactly one of timeDate/timeDuration/timeCycle\");","typeGuard":null,"tryCatchPattern":"try {\n    managementService.rescheduleTimeDurationJob(jobId, duration, endDate);\n} catch (FlowableIllegalArgumentException e) {\n    // handle invalid schedule combination\n}","preventionTips":["Always null out unused schedule fields before rescheduling","Model schedule mode as an enum and map it to exactly one field","Write a unit test asserting exactly one time field per reschedule call"],"tags":["validation","timer","scheduler","illegal-argument"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}