flowable/flowable-engine · error · ActivitiIllegalArgumentException

Due date expression does not resolve to a Date or Date strin

Error message

Due date expression does not resolve to a Date or Date string: %s

What it means

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.

Source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java:164

                description = activeDescriptionExpression.getExpressionText();
                LOGGER.warn("property not found in task description expression {}", e.getMessage());
            }
            task.setDescription(description);
        }

        if (activeDueDateExpression != null) {
            Object dueDate = activeDueDateExpression.getValue(execution);
            if (dueDate != null) {
                if (dueDate instanceof Date) {
                    task.setDueDate((Date) dueDate);
                } else if (dueDate instanceof String) {
                    BusinessCalendar businessCalendar = Context
                            .getProcessEngineConfiguration()
                            .getBusinessCalendarManager()
                            .getBusinessCalendar(taskDefinition.getBusinessCalendarNameExpression().getValue(execution).toString());
                    task.setDueDate(businessCalendar.resolveDuedate((String) dueDate));
                } else {
                    throw new ActivitiIllegalArgumentException("Due date expression does not resolve to a Date or Date string: " +
                            activeDueDateExpression.getExpressionText());
                }
            }
        }

        if (activePriorityExpression != null) {
            final Object priority = activePriorityExpression.getValue(execution);
            if (priority != null) {
                if (priority instanceof String) {
                    try {
                        task.setPriority(Integer.valueOf((String) priority));
                    } catch (NumberFormatException e) {
                        throw new ActivitiIllegalArgumentException("Priority does not resolve to a number: " + priority, e);
                    }
                } else if (priority instanceof Number) {
                    task.setPriority(((Number) priority).intValue());
                } else {
                    throw new ActivitiIllegalArgumentException("Priority expression does not resolve to a number: " +

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. 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.
  2. If you want a relative due date, use an ISO-8601 duration string directly (activiti:dueDate="P3D") instead of a variable of another type.
  3. Convert the variable before the task: execution.setVariable("dueDate", new Date(...)) or store an ISO string the business calendar can parse.
  4. Check the business calendar named by activiti:businessCalendarName exists in the BusinessCalendarManager and can parse the supplied string.
  5. Example fix

Example fix

// before
execution.setVariable("dueDate", System.currentTimeMillis());
<userTask activiti:dueDate="${dueDate}"/>
// after
execution.setVariable("dueDate", new java.util.Date());
<userTask activiti:dueDate="${dueDate}"/>
Defensive patterns

Strategy: type-guard

Validate before calling

Object dueDate = execution.getVariable("dueDate");
if (dueDate != null && !(dueDate instanceof java.util.Date) && !(dueDate instanceof String)) {
    throw new IllegalArgumentException("dueDate must be Date or ISO date/duration String, got: " + dueDate.getClass());
}
if (dueDate instanceof String) {
    // verify parseable
    org.joda.time.format.ISODateTimeFormat.dateTimeParser().parseDateTime((String) dueDate);
}

Type guard

static boolean isValidDueDate(Object v) {
    return v == null
        || v instanceof java.util.Date
        || (v instanceof String && (isIsoDate((String) v) || isIsoDuration((String) v)));
}

Try / catch

try {
    taskService.complete(taskId);
} catch (ActivitiIllegalArgumentException e) {
    if (e.getMessage().startsWith("Due date expression does not resolve")) {
        log.error("dueDate variable type wrong; expected Date or ISO string", e);
        runtimeService.setVariable(executionId, "dueDate", new Date());
    }
    throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/8687e6632b291823. Report an issue: GitHub.