flowable/flowable-engine · warning · FlowableIllegalArgumentException
Only 'binary' and 'serializable' are supported as variable…
Error message
Only 'binary' and 'serializable' are supported as variable type.
What it means
FlowableIllegalArgumentException thrown when the optional variable_type field is provided but is neither 'binary' nor 'serializable'. The binary-variable upload endpoint only supports these two types; any other declared type is rejected, while omitting the field defaults to 'binary'.
Solutions
- Set variable_type to exactly 'binary' or 'serializable', or omit the field entirely to default to binary
- If the variable should hold a primitive/string value, use the JSON variable PUT endpoint instead of the binary upload
- Catch FlowableIllegalArgumentException and return 400 listing allowed values
Example fix
// before -F "variable_type=string" // after -F "variable_type=binary"
Defensive patterns
Strategy: validation
Validate before calling
if (variableType != null && !Set.of("binary","serializable").contains(variableType)) {
throw new IllegalArgumentException("variable_type must be 'binary' or 'serializable' (or omitted)");
} Try / catch
try {
client.uploadBinaryVariable(executionId, name, file, type);
} catch (HttpClientErrorException.BadRequest e) {
// correct variable_type and retry
} Prevention
- Omit variable_type to accept the 'binary' default
- Use only the exact lowercase literals 'binary' and 'serializable'
- For non-binary values use the JSON variable endpoint instead
When it happens
Trigger: Multipart variable upload including variable_type=string/integer/long/etc., or a typo like 'byte-array' instead of 'binary'.
Common situations: Clients copying the type names from general variable APIs where other types exist; case-sensitivity mistakes ('Binary' vs 'binary'); assuming type matching the actual content type.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Invalid body was supplied
- No variable name was found in request body.
- Only 'binary' and 'serializable' are supported as variable…
- Only 'binary' and 'serializable' are supported as variable…
- Transient variable name is required
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/19be229e46b437ce.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java:146
} else if ("name".equalsIgnoreCase(parameterName)) {
variableName = paramMap.get(parameterName)[0];
} else if ("type".equalsIgnoreCase(parameterName)) {
variableType = paramMap.get(parameterName)[0];
}
}
}
try {
// Validate input and set defaults
if (variableName == null) {
throw new FlowableIllegalArgumentException("No variable name was found in request body.");
}
if (variableType != null) {
if (!RestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE.equals(variableType) && !RestResponseFactory.SERIALIZABLE_VARIABLE_TYPE.equals(variableType)) {
throw new FlowableIllegalArgumentException("Only 'binary' and 'serializable' are supported as variable type.");
}
} else {
variableType = RestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE;
}
RestVariableScope scope = RestVariableScope.LOCAL;
if (variableScope != null) {
scope = RestVariable.getScopeFromString(variableScope);
}
if (variableType.equals(RestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE)) {
// Use raw bytes as variable value
byte[] variableBytes = IOUtils.toByteArray(file.getInputStream());
setVariable(execution, variableName, variableBytes, scope, isNew, async);
} else if (isSerializableVariableAllowed) {
// Try deserializing the object
ObjectInputStream stream = new ObjectInputStream(file.getInputStream());View on GitHub (pinned to d6d39ce1c6)