{"record":{"id":"8687e6632b291823","repo":"flowable/flowable-engine","slug":"due-date-expression-does-not-resolve-to-a-date-or","errorCode":null,"errorMessage":"Due date expression does not resolve to a Date or Date string: %s","messagePattern":"Due date expression does not resolve to a Date or Date string: (.+?)","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java","lineNumber":164,"sourceCode":"                description = activeDescriptionExpression.getExpressionText();\n                LOGGER.warn(\"property not found in task description expression {}\", e.getMessage());\n            }\n            task.setDescription(description);\n        }\n\n        if (activeDueDateExpression != null) {\n            Object dueDate = activeDueDateExpression.getValue(execution);\n            if (dueDate != null) {\n                if (dueDate instanceof Date) {\n                    task.setDueDate((Date) dueDate);\n                } else if (dueDate instanceof String) {\n                    BusinessCalendar businessCalendar = Context\n                            .getProcessEngineConfiguration()\n                            .getBusinessCalendarManager()\n                            .getBusinessCalendar(taskDefinition.getBusinessCalendarNameExpression().getValue(execution).toString());\n                    task.setDueDate(businessCalendar.resolveDuedate((String) dueDate));\n                } else {\n                    throw new ActivitiIllegalArgumentException(\"Due date expression does not resolve to a Date or Date string: \" +\n                            activeDueDateExpression.getExpressionText());\n                }\n            }\n        }\n\n        if (activePriorityExpression != null) {\n            final Object priority = activePriorityExpression.getValue(execution);\n            if (priority != null) {\n                if (priority instanceof String) {\n                    try {\n                        task.setPriority(Integer.valueOf((String) priority));\n                    } catch (NumberFormatException e) {\n                        throw new ActivitiIllegalArgumentException(\"Priority does not resolve to a number: \" + priority, e);\n                    }\n                } else if (priority instanceof Number) {\n                    task.setPriority(((Number) priority).intValue());\n                } else {\n                    throw new ActivitiIllegalArgumentException(\"Priority expression does not resolve to a number: \" +","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java#L146-L182","documentation":"Thrown when a user task's due-date expression evaluates to something that is neither a Date nor a String parseable by the configured BusinessCalendar. The behavior only accepts Date instances or date strings it can resolve to a due date; any other type (e.g. Integer, boolean) reaches this error.","triggerScenarios":"A user task defines activiti:dueDate as an expression such as ${someVar}, the resolved value is non-null but is not a java.util.Date and not a String, or the String form is used together with a business calendar that cannot parse it (via resolveDuedate on the cast).","commonSituations":"Setting the due date variable from JSON/forms to a numeric timestamp or epoch long instead of a Date/ISO string; expressions referencing a variable of the wrong type; mixing ISO date strings with an unsupported business-calendar name; ISO-8601 duration strings (e.g. 'P3D') being used where the code path expects a calendar-resolvable date string.","solutions":["Make the dueDate expression resolve to a java.util.Date, e.g. ${dueDateVar} where dueDateVar is a Date, or use an ISO-8601 date string like 2026-01-15T10:00:00.","If you want a relative due date, use an ISO-8601 duration string directly (activiti:dueDate=\"P3D\") instead of a variable of another type.","Convert the variable before the task: execution.setVariable(\"dueDate\", new Date(...)) or store an ISO string the business calendar can parse.","Check the business calendar named by activiti:businessCalendarName exists in the BusinessCalendarManager and can parse the supplied string.","Example fix"],"exampleFix":"// before\nexecution.setVariable(\"dueDate\", System.currentTimeMillis());\n<userTask activiti:dueDate=\"${dueDate}\"/>\n// after\nexecution.setVariable(\"dueDate\", new java.util.Date());\n<userTask activiti:dueDate=\"${dueDate}\"/>","handlingStrategy":"type-guard","validationCode":"Object dueDate = execution.getVariable(\"dueDate\");\nif (dueDate != null && !(dueDate instanceof java.util.Date) && !(dueDate instanceof String)) {\n    throw new IllegalArgumentException(\"dueDate must be Date or ISO date/duration String, got: \" + dueDate.getClass());\n}\nif (dueDate instanceof String) {\n    // verify parseable\n    org.joda.time.format.ISODateTimeFormat.dateTimeParser().parseDateTime((String) dueDate);\n}","typeGuard":"static boolean isValidDueDate(Object v) {\n    return v == null\n        || v instanceof java.util.Date\n        || (v instanceof String && (isIsoDate((String) v) || isIsoDuration((String) v)));\n}","tryCatchPattern":"try {\n    taskService.complete(taskId);\n} catch (ActivitiIllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Due date expression does not resolve\")) {\n        log.error(\"dueDate variable type wrong; expected Date or ISO string\", e);\n        runtimeService.setVariable(executionId, \"dueDate\", new Date());\n    }\n    throw e;\n}","preventionTips":["Set due-date variables as java.util.Date or ISO-8601 date/duration strings.","Never store epoch millis/longs in the variable used by activiti:dueDate.","Prefer static due dates (e.g. P3D durations) in BPMN XML when possible.","Verify the referenced business calendar exists in BusinessCalendarManager configuration.","Add a form/model-level validation that dueDate fields emit Date or ISO strings."],"tags":["user-task","due-date","expression","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}