{"record":{"id":"2017dde4cb3670e3","repo":"flowable/flowable-engine","slug":"due-date-expression-does-not-resolve-to-a-date-in","errorCode":null,"errorMessage":"Due date expression does not resolve to a Date, Instant, LocalDate, LocalDateTime or Date string: ","messagePattern":"Due date expression does not resolve to a Date, Instant, LocalDate, LocalDateTime or Date string: ","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/HumanTaskActivityBehavior.java","lineNumber":349,"sourceCode":"                    taskEntity.setDueDate((Date) dueDate);\n\n                } else if (dueDate instanceof String dueDateString) {\n                    Date resolvedDuedate = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getBusinessCalendarManager()\n                            .getBusinessCalendar(DueDateBusinessCalendar.NAME)\n                            .resolveDuedate(dueDateString);\n                    taskEntity.setDueDate(resolvedDuedate);\n\n                } else if (dueDate instanceof Instant) {\n                    taskEntity.setDueDate(Date.from((Instant) dueDate));\n\n                } else if (dueDate instanceof LocalDate) {\n                    taskEntity.setDueDate(Date.from(((LocalDate) dueDate).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()));\n\n                }  else if (dueDate instanceof LocalDateTime) {\n                    taskEntity.setDueDate(Date.from(((LocalDateTime) dueDate).atZone(ZoneId.systemDefault()).toInstant()));\n\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 handleCategory(PlanItemInstanceEntity planItemInstanceEntity, ExpressionManager expressionManager,\n            TaskEntity taskEntity, CreateHumanTaskBeforeContext beforeContext, MigrationContext migrationContext) {\n        \n        String categoryStringValue = null;\n        if (migrationContext != null && migrationContext.getCategory() != null) {\n            categoryStringValue = migrationContext.getCategory();\n            \n        } else if (StringUtils.isNotEmpty(beforeContext.getCategory())) {\n            categoryStringValue = beforeContext.getCategory();\n        }\n        \n        if (StringUtils.isNotEmpty(categoryStringValue)) {\n            final Object category = expressionManager.createExpression(categoryStringValue).getValue(planItemInstanceEntity);","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/HumanTaskActivityBehavior.java#L331-L367","documentation":"The due date attribute expression resolved to an object of an unsupported type. Flowable accepts java.util.Date, Instant, LocalDate, LocalDateTime, or a String parseable as a date; anything else (Calendar, ZonedDateTime, custom type) is rejected with FlowableIllegalArgumentException enumerating the accepted types.","triggerScenarios":"HumanTaskActivityBehavior.execute -> handleDueDate, when the dueDate expression returns a non-null object failing all accepted instanceof branches (Date, Instant, LocalDate, LocalDateTime, String).","commonSituations":"Variable is a ZonedDateTime/OffsetDateTime or java.sql.Timestamp subclass branch not handled; expression returns a Date-formatted display String with a locale-specific pattern the parser cannot read; JS/ Groovy evaluation returning a wrapped type.","solutions":["Normalize the variable to java.util.Date or LocalDateTime before the plan item executes.","If it is ZonedDateTime/OffsetDateTime, convert: Date.from(zdt.toInstant()) when setting the variable.","If it is a String, use a format Flowable can parse (e.g. ISO-8601 yyyy-MM-dd or full date-time) or provide a java.util.Date.","Catch FlowableIllegalArgumentException and log beforeContext.getDueDate() plus the value's class to identify the offending type."],"exampleFix":"// before\nexecution.setVariable(\"dueDate\", ZonedDateTime.now().plusDays(2));\n// after\nexecution.setVariable(\"dueDate\", Date.from(ZonedDateTime.now().plusDays(2).toInstant()));","handlingStrategy":"type-guard","validationCode":"Object d = variableScope.getVariable(\"dueDate\");\nboolean ok = d == null || d instanceof java.util.Date || d instanceof java.time.Instant\n    || d instanceof java.time.LocalDate || d instanceof java.time.LocalDateTime;\nif (!ok) throw new IllegalArgumentException(\"dueDate must be Date, Instant, LocalDate or LocalDateTime, got \" + (d == null ? \"null\" : d.getClass()));","typeGuard":"boolean isValidDueDate(Object v) { return v == null || v instanceof java.util.Date || v instanceof java.time.Instant || v instanceof java.time.LocalDate || v instanceof java.time.LocalDateTime; }","tryCatchPattern":"try {\n    // execute human task\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Due date expression\")) {\n        log.error(\"Unsupported due date type: {}\", e.getMessage());\n    }\n}","preventionTips":["Normalize all date variables to java.util.Date or LocalDateTime before case execution","Avoid ZonedDateTime/OffsetDateTime/Timestamp in variables","Use ISO-8601 strings if passing dates as text"],"tags":["cmmn","expression","date","type-mismatch"],"backgroundTag":"invalid-date-format","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"}