flowable/flowable-engine · error · FlowableIllegalArgumentException
Only 'binary' and 'serializable' are supported as variable t
Error message
Only 'binary' and 'serializable' are supported as variable type.
What it means
FlowableIllegalArgumentException thrown by setBinaryVariable when the optional 'variableType' form field is provided but is neither 'binary' nor 'serializable' (the two types CmmnRestResponseFactory supports for binary variables).
Source
Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseVariableResource.java:348
} 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 (!CmmnRestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE.equals(variableType) && !CmmnRestResponseFactory.SERIALIZABLE_VARIABLE_TYPE.equals(variableType)) {
throw new FlowableIllegalArgumentException("Only 'binary' and 'serializable' are supported as variable type.");
}
} else {
variableType = CmmnRestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE;
}
if (variableScope != null) {
scope = RestVariable.getScopeFromString(variableScope);
}
if (variableType.equals(CmmnRestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE)) {
// Use raw bytes as variable value
byte[] variableBytes = IOUtils.toByteArray(file.getInputStream());
setVariable(instanceId, variableName, variableBytes, scope, isNew, async, variableInterceptor);
} else if (isSerializableVariableAllowed) {
// Try deserializing the object
ObjectInputStream stream = new ObjectInputStream(file.getInputStream());
Object value = stream.readObject();View on GitHub (pinned to d6d39ce1c6)
Solutions
- Set variableType=binary for raw bytes or variableType=serializable for Java-serialized objects.
- Omit the variableType field entirely to default to 'binary'.
- Use lowercase exact strings; any other type is rejected.
Example fix
// before -F "variableName=doc" -F "variableType=string" // after -F "variableName=doc" -F "variableType=binary" # or omit variableType
Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = ['binary', 'serializable'];
if (variableType && !ALLOWED.includes(variableType)) {
throw new Error(`variableType must be one of ${ALLOWED}, got '${variableType}'`);
} Type guard
function isBinaryVariableType(t) { return t == null || t === 'binary' || t === 'serializable'; } Try / catch
try {
await uploadBinaryVariable(id, formData);
} catch (e) {
if (/Only 'binary' and 'serializable'/.test(e.message)) throw new Error('Use variableType=binary or serializable, or omit it');
throw e;
} Prevention
- Omit variableType to get the default 'binary'.
- Use exactly the lowercase strings 'binary' or 'serializable'.
- Do not reuse type names from the JSON variable API (string, integer, json...) on the binary endpoint.
When it happens
Trigger: Multipart binary variable upload with variableType=form, string, json, or any other unsupported string.
Common situations: Copy-pasting variableType values from the general (JSON) variable API, which supports many types; case-sensitivity mistakes ('Binary'); clients guessing the type field values.
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
- Variable '${restVariable.getName()}' has unsupported type: '
- Unsupported variable query operation: ${friendlyName}
- Invalid variable scope: '${scope}'
- Request didn't contain a list of variables to create.
- Variable name is required
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/cd7507c22a6d7b29.
Report an issue: GitHub.