flowable/flowable-engine · error · FlowableIllegalArgumentException

Converter can only convert booleans

Error message

Converter can only convert booleans

What it means

DateRestVariableConverter.convertVariableValue serializes a java.util.Date to ISO-8601 for REST output. If the value handed to the converter is not null and not a Date, it throws this FlowableIllegalArgumentException. The message is a known copy-paste bug in the Flowable source: it says 'booleans' although this converter handles dates.

Source

Thrown at modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/DateRestVariableConverter.java:56

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

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

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Store the variable as a java.util.Date so the date converter receives the expected type.
  2. Check the REST variable converter registry for a misconfigured converter claiming to handle java.util.Date.
  3. Use the correct REST variable type name (e.g. 'string' or 'instant') that matches the actual stored value.
  4. Ignore the misleading 'booleans' wording; it is a message typo — the real issue is a type mismatch with Date.

Example fix

// before
runtimeService.setVariable(executionId, "createdAt", "2026-09-10");
// after
runtimeService.setVariable(executionId, "createdAt", new Date());
Defensive patterns

Strategy: type-guard

Validate before calling

public static boolean isRestDateValue(Object v) { return v == null || v instanceof java.util.Date; }

Type guard

public static java.util.Date asDate(Object v) {
    if (v instanceof java.util.Date d) return d;
    if (v instanceof java.time.Instant i) return java.util.Date.from(i);
    return null;
}

Try / catch

try {
    converter.convertVariableValue(value, restVariable);
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().equals("Converter can only convert booleans")) {
        converter.convertVariableValue(asDate(value), restVariable);
    } else { throw e; }
}

Prevention

When it happens

Trigger: The REST layer passes a non-Date, non-null object (e.g. String, Long, Instant) to the date converter, either because the variable type was misregistered or because the value was stored as a different type than the converter's getVariableType() (java.util.Date) claims.

Common situations: Custom variable converters registered with overlapping types; a variable stored as String but requested with the date converter; upgrading Flowable versions changed variable serialization defaults.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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