{"record":{"id":"d536cf8ffafcd406","repo":"flowable/flowable-engine","slug":"due-date-expression-does-not-resolve-to-a-date-in-d536cf","errorCode":null,"errorMessage":"Due date expression does not resolve to a Date, Instant, LocalDate, LocalDateTime or Date string: + beforeContext.getDueDate()","messagePattern":"Due date expression does not resolve to a Date, Instant, LocalDate, LocalDateTime or Date string: \\+ beforeContext\\.getDueDate\\(\\)","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java","lineNumber":274,"sourceCode":"                    if (StringUtils.isNotEmpty(userTask.getBusinessCalendarName())) {\n                        businessCalendarName = expressionManager.createExpression(userTask.getBusinessCalendarName()).getValue(execution).toString();\n                    } else {\n                        businessCalendarName = DueDateBusinessCalendar.NAME;\n                    }\n\n                    BusinessCalendar businessCalendar = processEngineConfiguration.getBusinessCalendarManager()\n                            .getBusinessCalendar(businessCalendarName);\n                    task.setDueDate(businessCalendar.resolveDuedate((String) dueDate));\n                } else if (dueDate instanceof Instant) {\n                    task.setDueDate(Date.from((Instant) dueDate));\n                } else if (dueDate instanceof LocalDate) {\n                    Date localDueDate = Date.from(((LocalDate) dueDate).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());\n                    task.setDueDate(localDueDate);\n                } else if (dueDate instanceof LocalDateTime) {\n                    Date localDueDate = Date.from(((LocalDateTime) dueDate).atZone(ZoneId.systemDefault()).toInstant());\n                    task.setDueDate(localDueDate);\n                } else {\n                    throw new FlowableIllegalArgumentException(\"Due date expression does not resolve to a Date, Instant, LocalDate, LocalDateTime or Date string: \" + beforeContext.getDueDate());\n                }\n            }\n        }\n    }\n\n    protected void handlePriority(CreateUserTaskBeforeContext beforeContext, ExpressionManager expressionManager, TaskEntity task, DelegateExecution execution,\n            String activeTaskPriority) {\n        if (StringUtils.isNotEmpty(beforeContext.getPriority())) {\n            final Object priority = expressionManager.createExpression(beforeContext.getPriority()).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 FlowableIllegalArgumentException(\"Priority does not resolve to a number: \" + priority, e);\n                    }\n                } else if (priority instanceof Number) {\n                    task.setPriority(((Number) priority).intValue());","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java#L256-L292","documentation":"The user task's flowable:dueDate expression resolved to an object whose type the engine cannot turn into a task due date. Only Date, Date-time (java.util.Date), String parseable as a date, Instant, LocalDate and LocalDateTime are accepted. A FlowableIllegalArgumentException is thrown when the expression evaluates to some other type.","triggerScenarios":"flowable:dueDate expression like ${someVar} or ${bean.compute()} returning e.g. Integer, ZonedDateTime, OffsetDateTime, String in an unparseable format, or an unsupported object.","commonSituations":"Using ZonedDateTime/OffsetDateTime which are NOT supported (only LocalDate/LocalDateTime/Instant); expression returning a formatted String the date parser cannot read; passing a timestamp long from a variable; Spring bean method returning the wrong type.","solutions":["Change the expression/bean to return java.util.Date, Instant, LocalDate, LocalDateTime, or a date-String in an accepted format","Convert ZonedDateTime/OffsetDateTime via toLocalDateTime() or Date.from(...) before returning it","Set the process variable to the correct type before reaching the user task","Fix the ISO date format of the String if returning text","Wrap the logic in a delegate that normalizes the value"],"exampleFix":"// before\npublic ZonedDateTime getDueDate() { return ZonedDateTime.now().plusDays(2); }\n// after\npublic Date getDueDate() { return Date.from(ZonedDateTime.now().plusDays(2).toInstant()); }","handlingStrategy":"validation","validationCode":"Object d = dueDateExpr.getValue(execution);\nList<Class<?>> ok = List.of(Date.class, Instant.class, LocalDate.class, LocalDateTime.class, String.class);\nif (d != null && ok.stream().noneMatch(c -> c.isInstance(d))) {\n    throw new IllegalArgumentException(\"dueDate type not supported: \" + d.getClass());\n}","typeGuard":"boolean isValidDueDate(Object v) {\n    return v == null || v instanceof Date || v instanceof Instant\n        || v instanceof LocalDate || v instanceof LocalDateTime || v instanceof String;\n}","tryCatchPattern":"try {\n    completeTask(taskId, vars);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Due date expression\")) {\n        // fix variable type and retry\n    }\n}","preventionTips":["Use java.util.Date, Instant, LocalDate or LocalDateTime for dueDate values","Do NOT use ZonedDateTime/OffsetDateTime","Standardize date variables as ISO strings or Date objects","Add an execution listener to normalize due-date variables before user tasks"],"tags":["user-task","due-date","expression","type-mismatch"],"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"}