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

This Flowable CMMN REST error is thrown by setBinaryVariable when a request body sets a variable type that is not 'binary' or 'serializable'. Binary variable upload endpoints only accept these two type strings; anything else is rejected before the variable is stored. It guards the special multipart upload path for raw byte content.

Source

Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskVariableBaseResource.java:167

                } 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 (!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;
            }

            RestVariableScope scope = RestVariableScope.LOCAL;
            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(task, variableName, variableBytes, scope, isNew);

            } else if (isSerializableVariableAllowed) {
                // Try deserializing the object
                ObjectInputStream stream = new ObjectInputStream(file.getInputStream());

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Remove the 'type' form field entirely so the default 'binary' is used
  2. Set the type field to 'binary' for raw bytes
  3. Set the type field to 'serializable' only when uploading a Java-serialized object
  4. Use the regular JSON variables endpoint instead if the value is a simple typed value

Example fix

// before (multipart form)
type=string
// after
type=binary   (or omit the type field)
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = new Set(['binary','serializable']);
if (type && !ALLOWED.has(type)) throw new Error(`type must be 'binary' or 'serializable', got: ${type}`);

Type guard

const isBinaryType = (t) => t === undefined || t === null || t === 'binary' || t === 'serializable';

Prevention

When it happens

Trigger: POSTing/PUTting to the task binary variable endpoint (e.g. POST /cmmn-runtime/tasks/{taskId}/variables) with multipart content and a 'type' form field set to something other than 'binary' or 'serializable', e.g. 'string' or 'byte[]'.

Common situations: Developers copying JSON-variable type names ('string','integer','json') into the binary upload form field; API clients auto-generating type fields; confusion between the JSON variables endpoint and the binary content endpoint.

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


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/8aeb63e37f10fc65. Report an issue: GitHub.