{"record":{"id":"510b51ac242b83b1","repo":"Activiti/Activiti","slug":"couldn-t-resolve-duedate","errorCode":null,"errorMessage":"couldn't resolve duedate: ","messagePattern":"couldn't resolve duedate: ","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/calendar/DueDateBusinessCalendar.java","lineNumber":44,"sourceCode":"public class DueDateBusinessCalendar extends BusinessCalendarImpl {\n\n    public static final String NAME = \"dueDate\";\n\n    public DueDateBusinessCalendar(ClockReader clockReader) {\n        super(clockReader);\n    }\n\n    @Override\n    public Date resolveDuedate(String duedate, int maxIterations) {\n        try {\n            // check if due period was specified\n            if (duedate.startsWith(\"P\")) {\n                return new DateTime(clockReader.getCurrentTime()).plus(Period.parse(duedate)).toDate();\n            }\n\n            return DateTime.parse(duedate).toDate();\n        } catch (Exception e) {\n            throw new ActivitiException(\"couldn't resolve duedate: \" + e.getMessage(), e);\n        }\n    }\n}\n","sourceCodeStart":26,"sourceCodeEnd":48,"githubUrl":"https://github.com/Activiti/Activiti/blob/56435b1a97deeafdc09dd40074b056c89fba5a8a/activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/calendar/DueDateBusinessCalendar.java#L26-L48","documentation":"DueDateBusinessCalendar.resolveDuedate resolves a duedate that is either an ISO-8601 date/time string (parsed with Joda's DateTime.parse) or an ISO-8601 period starting with 'P' (added to the current time). If any exception occurs while parsing the input string, it is wrapped in an ActivitiException with the message 'couldn't resolve duedate: ' plus the underlying cause. The real cause is in the wrapped exception, so inspect it to know which part of the input was unparseable.","triggerScenarios":"Passing a string that is neither a parseable ISO-8601 datetime nor an ISO-8601 period, e.g. 'tomorrow', '2024/01/01', 'not-a-date', or a period without the leading 'P' like 'T1D'.","commonSituations":"Configuring a timer/job dueDate with a human-readable date instead of ISO-8601 ('01-02-2024 10:00'); using locale-dependent formats; date-string built by string concatenation with wrong separators; confusion between this calendar and the default/duration calendars that accept other syntaxes.","solutions":["Provide an ISO-8601 datetime such as '2024-06-01T10:15:00' (what DateTime.parse accepts).","If the value is a relative offset, prefix it with 'P' (ISO-8601 period), e.g. 'P2DT4H' or 'PT30M'.","Pre-parse or validate the string with java.time (OffsetDateTime.parse / Duration.parse) or DateTime.parse in a try-catch before assigning it to the timer configuration.","Read the nested exception (getCause()) to identify the exact parse failure."],"exampleFix":"// before\nString duedate = \"01/06/2024 10:00\"; // ActivitiException: couldn't resolve duedate\n\n// after\nString duedate = \"2024-06-01T10:00:00\"; // ISO-8601 datetime\n// or relative: String duedate = \"PT30M\";","handlingStrategy":"validation","validationCode":"boolean isValidDueDateCalendarValue(String duedate) {\n    if (duedate == null || duedate.isEmpty()) return false;\n    try {\n        if (duedate.startsWith(\"P\")) {\n            org.joda.time.Period.parse(duedate);\n        } else {\n            org.joda.time.DateTime.parse(duedate);\n        }\n        return true;\n    } catch (Exception e) {\n        return false;\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    Date d = calendarManager.getBusinessCalendar(\"dueDate\").resolveDuedate(duedate);\n} catch (ActivitiException e) {\n    log.error(\"Unparseable duedate '{}': must be ISO-8601 datetime or 'P'-prefixed period. Cause: {}\", duedate, e.getCause(), e);\n    throw new IllegalArgumentException(\"duedate must be ISO-8601: \" + duedate, e);\n}","preventionTips":["Use ISO-8601 datetimes: '2024-06-01T10:15:00'.","Prefix relative offsets with 'P' (e.g. 'P2DT4H'); periods without 'P' fail.","Never pass human-readable dates like 'tomorrow' or '01/06/2024'.","Pre-validate with DateTime.parse in tests covering all timer expressions in your process definitions."],"tags":["java","activiti","duedate","iso8601","date-parsing"],"backgroundTag":"invalid-date-format","analyzedSha":"56435b1a97deeafdc09dd40074b056c89fba5a8a","analyzedAt":"2026-09-09T21:00:06.703Z","contentChangedAt":"2026-09-09T21:00:06.703Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}