flowable/flowable-engine · error · FlowableIllegalArgumentException

The given variable value is not a localDateTime: '" +…

Error message

The given variable value is not a localDateTime: '" + result.getValue() + "'

What it means

Once the value is confirmed to be a String, LocalDateTimeRestVariableConverter.getVariableValue calls LocalDateTime.parse; strings that are not valid ISO-8601 local datetimes raise DateTimeParseException, which is wrapped in FlowableIllegalArgumentException including the offending value and the parse exception as cause.

Solutions

  1. Format the value as ISO-8601 local datetime (DateTimeFormatter.ISO_LOCAL_DATE_TIME) before sending.
  2. Validate with LocalDateTime.parse client-side to catch bad formats early.
  3. If the value has a zone/offset, convert to a LocalDateTime (or use a zoned variable type) first.
  4. Date-only strings should either gain a time part or be sent as localDate variables.

Example fix

// before
variable.setValue("2026-09-10 14:30");

// after
variable.setValue(LocalDateTime.of(2026, 9, 10, 14, 30).toString()); // "2026-09-10T14:30"
Defensive patterns

Strategy: validation

Validate before calling

try {
    LocalDateTime.parse(value);
} catch (DateTimeParseException e) {
    throw new IllegalArgumentException("Value must be ISO local datetime, got: " + value, e);
}

Type guard

static boolean isValidIsoLocalDateTime(String s) {
    try { LocalDateTime.parse(s); return true; } catch (DateTimeParseException | NullPointerException e) { return false; }
}

Try / catch

try {
    Object value = converter.getVariableValue(restVar);
} catch (FlowableIllegalArgumentException e) {
    if (e.getCause() instanceof DateTimeParseException dpe) {
        log.error("localDateTime '{}' is not ISO format", restVar.getValue(), dpe);
    }
}

Prevention

When it happens

Trigger: Posting a localDateTime variable whose string is not ISO-8601: e.g. "10-09-2026 14:30", "2026/09/10 14:30", date-only "2026-09-10", epoch strings, or values with unsupported zone/offset suffixes for parse.

Common situations: Human-formatted datetimes from UI inputs, date-only strings sent to datetime variables, "Z" or "+02:00" suffixes, locale-specific separators (space instead of 'T').

Related errors


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

Appendix: source

Thrown at modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/LocalDateTimeRestVariableConverter.java:44

    public String getRestTypeName() {
        return "localDateTime";
    }

    @Override
    public Class<?> getVariableType() {
        return LocalDateTime.class;
    }

    @Override
    public Object getVariableValue(EngineRestVariable result) {
        if (result.getValue() != null) {
            if (!(result.getValue() instanceof String)) {
                throw new FlowableIllegalArgumentException("Converter can only convert string to localDateTime");
            }
            try {
                return LocalDateTime.parse((String) result.getValue());
            } catch (DateTimeParseException e) {
                throw new FlowableIllegalArgumentException("The given variable value is not a localDateTime: '" + result.getValue() + "'", e);
            }
        }
        return null;
    }

    @Override
    public void convertVariableValue(Object variableValue, EngineRestVariable result) {
        if (variableValue != null) {
            if (!(variableValue instanceof LocalDateTime)) {
                throw new FlowableIllegalArgumentException("Converter can only convert localDateTime");
            }
            result.setValue(variableValue.toString());
        } else {
            result.setValue(null);
        }
    }

}

View on GitHub (pinned to d6d39ce1c6)