flowable/flowable-engine · error · FlowableIllegalArgumentException

Converter can only convert big integer values

Error message

Converter can only convert big integer values

What it means

BigIntegerRestVariableConverter handles only java.math.BigInteger engine variables. In convertVariableValue it type-checks the value and throws FlowableIllegalArgumentException for any non-BigInteger object, since the converter's wire format (a plain string) is only defined for BigInteger.

Source

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

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

    @Override
    public Object getVariableValue(EngineRestVariable result) {
        if (result.getValue() != null) {
            return new BigInteger(result.getValue().toString());
        }
        return null;
    }

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

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Pass a java.math.BigInteger to the converter (use BigInteger.valueOf(longValue) for longs).
  2. Send REST variables with the correct type name so the matching converter (integer/long) is selected instead.
  3. If the underlying value is a BigDecimal, use BigDecimalRestVariableConverter rather than this one.
  4. In custom code, branch on the runtime type before choosing which RestVariableConverter to call.

Example fix

// before
converter.convertVariableValue(42L, restVariable); // Long -> throws
// after
converter.convertVariableValue(BigInteger.valueOf(42L), restVariable);
Defensive patterns

Strategy: type-guard

Validate before calling

if (value != null && !(value instanceof BigInteger)) {
    value = BigInteger.valueOf(((Number) value).longValue());
}

Type guard

BigInteger asBigInteger(Object v) {
    if (v instanceof BigInteger) return (BigInteger) v;
    if (v instanceof Number) return BigInteger.valueOf(((Number) v).longValue());
    return null;
}

Try / catch

try {
    converter.convertVariableValue(value, restVariable);
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().contains("big integer")) {
        converter.convertVariableValue(BigInteger.valueOf(((Number) value).longValue()), restVariable);
    } else throw e;
}

Prevention

When it happens

Trigger: A variable value that is not BigInteger (e.g. Long, Integer, BigDecimal) reaching this converter during REST variable conversion, or direct calls to convertVariableValue with the wrong numeric type.

Common situations: Direct converter invocation in custom REST extensions with a Long value; REST request type names mismatched so the wrong converter is chosen; engine variables migrated from Long to BigInteger (or vice versa) across versions.

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/658e03dc6a25da84. Report an issue: GitHub.