flowable/flowable-engine · error · FlowableIllegalArgumentException
Converter can only convert doubles
Error message
Converter can only convert doubles
What it means
DoubleRestVariableConverter.getVariableValue converts an engine variable value into a Double for REST output. If the stored value is non-null but not a Number, the converter cannot produce a double and throws this FlowableIllegalArgumentException.
Source
Thrown at modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/DoubleRestVariableConverter.java:37
* @author Frederik Heremans
*/
public class DoubleRestVariableConverter implements RestVariableConverter {
@Override
public String getRestTypeName() {
return "double";
}
@Override
public Class<?> getVariableType() {
return Double.class;
}
@Override
public Object getVariableValue(EngineRestVariable result) {
if (result.getValue() != null) {
if (!(result.getValue() instanceof Number)) {
throw new FlowableIllegalArgumentException("Converter can only convert doubles");
}
return ((Number) result.getValue()).doubleValue();
}
return null;
}
@Override
public void convertVariableValue(Object variableValue, EngineRestVariable result) {
if (variableValue != null) {
if (!(variableValue instanceof Double)) {
throw new FlowableIllegalArgumentException("Converter can only convert doubles");
}
result.setValue(variableValue);
} else {
result.setValue(null);
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Request the variable with the REST type matching the stored value (e.g. 'string').
- Re-set the variable in the engine as a numeric type (Double, Integer, Long).
- Parse the value to a number before storing it if it arrives as a string from an upstream source.
- Verify no custom variable converter collides with the double converter's type.
Example fix
// before runtimeService.setVariable(executionId, "amount", "3.14"); // after runtimeService.setVariable(executionId, "amount", 3.14);
Defensive patterns
Strategy: type-guard
Validate before calling
public static boolean isNumericValue(Object v) { return v == null || v instanceof Number; } Type guard
public static boolean isNumber(Object v) { return v instanceof Number; } Try / catch
try {
Object d = restClient.getVariable(id, "amount");
} catch (FlowableIllegalArgumentException e) {
if (e.getMessage().equals("Converter can only convert doubles")) {
// request the variable as its actual type or fix the stored value
} else { throw e; }
} Prevention
- Set numeric variables as Double/Integer/Long, never numeric strings.
- Match the REST variable type query parameter to the stored Java type.
- Avoid writing variables directly to the DB; use engine APIs.
When it happens
Trigger: Reading a REST variable with type 'double' when the underlying engine value is a non-numeric object (String, Boolean, arbitrary Serializable) instead of a numeric type.
Common situations: Variable declared 'double' in the REST request while the engine holds a string; manual DB edits to variable tables; a custom converter wrote a non-numeric value.
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
- Converter can only convert booleans
- Converter can only convert string to instant
- Converter can only convert instant
- Converter can only convert integers
- Variable '${restVariable.getName()}' has unsupported type: '
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/55ece4d3069dd6ab.
Report an issue: GitHub.