flowable/flowable-engine · error · FlowableIllegalArgumentException
Model value is not of type boolean, but of type " +…
Error message
Model value is not of type boolean, but of type " + modelValue.getClass().getName()
What it means
BooleanFormType.convertModelValueToFormValue converts a model (variable) value to its form representation and only accepts Boolean/primitive-boolean values. Any other type is rejected with FlowableIllegalArgumentException naming the actual class. It enforces that the form type declared in the BPMN form property matches the variable's Java type.
Solutions
- Store the variable as a Java Boolean before form conversion (runtimeService.setVariable with Boolean.valueOf(...)).
- Change the form property type in the BPMN (e.g. to 'string') if the value is genuinely textual.
- Parse strings at the boundary: Boolean.parseBoolean(value) before submitting.
- Add a form conversion/validation in custom form code to coerce types before calling FormService.
Example fix
// before
runtimeService.setVariable(executionId, "approved", "true"); // String into boolean form type
// after
runtimeService.setVariable(executionId, "approved", Boolean.valueOf("true")); Defensive patterns
Strategy: type-guard
Validate before calling
Object v = runtimeService.getVariable(executionId, "approved");
if (v != null && !(v instanceof Boolean)) {
runtimeService.setVariable(executionId, "approved", Boolean.parseBoolean(v.toString()));
} Type guard
static boolean isBooleanValue(Object v) {
return v instanceof Boolean || v.getClass() == boolean.class;
} Try / catch
try {
formService.getStartFormData(pdId); // triggers conversion
} catch (FlowableIllegalArgumentException e) {
if (e.getMessage().startsWith("Model value is not of type boolean")) {
runtimeService.setVariable(executionId, varName, Boolean.valueOf(String.valueOf(rawValue)));
} else { throw e; }
} Prevention
- Declare boolean form properties and always store java.lang.Boolean in the variable.
- Coerce external-system values ("true"/"1") at the integration boundary.
- Add variable-type assertions in process tests.
- Avoid overwriting typed variables with raw request parameters.
When it happens
Trigger: FormService.getStartFormData/getTaskFormData rendering or FormPropertyHandler submissions where a form property of type 'boolean' has a variable value of another type (e.g. String "true", Integer 1).
Common situations: Setting the process variable from an external system as a String, XML/config loading variables as strings, version changes where the variable was previously free-typed.
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
- Model value is not of type boolean, but of type
- Model value should be a String
- This form type only support process definitions, but is " +…
- Value " " can not be converted into boolean
- App resource is not of type AppModel
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/e46b6e6d391c12cb.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/form/BooleanFormType.java:53
@Override
public Object convertFormValueToModelValue(String propertyValue) {
if (propertyValue == null || "".equals(propertyValue)) {
return null;
}
return Boolean.valueOf(propertyValue);
}
@Override
public String convertModelValueToFormValue(Object modelValue) {
if (modelValue == null) {
return null;
}
if (Boolean.class.isAssignableFrom(modelValue.getClass()) || boolean.class.isAssignableFrom(modelValue.getClass())) {
return modelValue.toString();
}
throw new FlowableIllegalArgumentException("Model value is not of type boolean, but of type " + modelValue.getClass().getName());
}
}
View on GitHub (pinned to d6d39ce1c6)