flowable/flowable-engine · error · FlowableIllegalArgumentException

The given variable value is not an instant: '" +…

Error message

The given variable value is not an instant: '" + result.getValue() + "'

What it means

InstantRestVariableConverter.getVariableValue calls Instant.parse on the string value; when parsing fails with DateTimeParseException it wraps it in a FlowableIllegalArgumentException naming the bad value. Instant.parse requires strict ISO-8601 with offset 'Z' or ±hh:mm.

Solutions

  1. Correct the variable value to a full ISO-8601 instant string ending with 'Z' or an offset, e.g. 2026-09-10T12:00:00Z.
  2. Store the value as an Instant/date type in the engine rather than a hand-formatted string.
  3. Normalize/validate the string with Instant.parse in application code before setVariable.
  4. If the value genuinely has no time zone, use the 'date' REST type or store a LocalDate representation instead.

Example fix

// before
runtimeService.setVariable(executionId, "timestamp", "2026-09-10T12:00:00");
// after
runtimeService.setVariable(executionId, "timestamp", "2026-09-10T12:00:00Z");
Defensive patterns

Strategy: validation

Validate before calling

public static boolean isValidInstant(String v) {
    if (v == null) return false;
    try { java.time.Instant.parse(v); return true; } catch (java.time.format.DateTimeParseException e) { return false; }
}

Type guard

public static boolean isParseableInstantString(Object v) { return v instanceof String s && isValidInstant(s); }

Try / catch

try {
    Object ts = restClient.getVariable(id, "firedAt");
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().startsWith("The given variable value is not an instant")) {
        // re-set the variable with a valid ISO-8601 instant string
    } else { throw e; }
}

Prevention

When it happens

Trigger: Reading an 'instant'-typed REST variable whose String value is not valid ISO-8601 instant syntax (e.g. '2026-09-10', '2026-09-10T10:00:00' without zone, '10-09-2026 10:00').

Common situations: Clients storing LocalDateTime/LocalDate strings without the mandatory zone offset; date-only strings; locale-formatted dates written by an external system or manual DB edit.

Related errors


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

Appendix: source

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

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

    @Override
    public Class<?> getVariableType() {
        return Instant.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 instant");
            }
            try {
                return Instant.parse((String) result.getValue());
            } catch (DateTimeParseException e) {
                throw new FlowableIllegalArgumentException("The given variable value is not an instant: '" + result.getValue() + "'", e);
            }
        }
        return null;
    }

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

}

View on GitHub (pinned to d6d39ce1c6)