flowable/flowable-engine · error · 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 by setBinaryVariable when the optional 'type' form field is present but is neither 'binary' nor 'serializable'. Only these two types are supported for binary variable uploads.
Solutions
- Omit the type field entirely (defaults to 'binary')
- Set type='binary' for byte data or type='serializable' for a Java-serialized object
- Remove invalid type values like json/string — non-binary types must use the JSON variable endpoint instead
Example fix
// before -F "name=myVar" -F "type=json" -F "file=@data.bin" // after -F "name=myVar" -F "type=binary" -F "file=@data.bin"
Defensive patterns
Strategy: validation
Validate before calling
if (type != null && !Set.of("binary","serializable").contains(type)) throw new IllegalArgumentException("type must be binary or serializable"); Try / catch
try { upload(...) } catch (FlowableIllegalArgumentException e) { retryWithoutTypeField(); } Prevention
- Omit the type field when unsure — it defaults to binary
- Use constants, not literals, for the type value
- Use the JSON variable endpoint for non-binary types
When it happens
Trigger: Multipart variable upload with type=string/integer/json or any value other than the exact strings 'binary' or 'serializable'.
Common situations: Guessing type names instead of using the documented constants; passing the Java class name or the value's own type as the type field.
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
- Multipart request is required
- Multipart request with file content is required
- No file content was found in request body.
- No file content was found in request body.
- No variable name was found in request body.
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/eb599de1b03fbd7e.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskVariableBaseResource.java:166
} else if ("name".equalsIgnoreCase(parameterName)) {
variableName = paramMap.get(parameterName)[0];
} else if ("type".equalsIgnoreCase(parameterName)) {
variableType = paramMap.get(parameterName)[0];
}
}
}
try {
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(task, variableName, variableBytes, scope, isNew);
} else if (isSerializableVariableAllowed) {
// Try deserializing the object
ObjectInputStream stream = new ObjectInputStream(file.getInputStream());View on GitHub (pinned to d6d39ce1c6)