flowable/flowable-engine · error · FlowableIllegalArgumentException

Error getting binary variable

Error message

Error getting binary variable

What it means

FlowableIllegalArgumentException wrapping an IOException raised while reading the uploaded binary variable content from the request stream in setBinaryVariable. It means the raw multipart content could not be read (stream errors, client disconnect, malformed multipart body). The original IOException is attached as the cause.

Source

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

                // 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());
                Object value = stream.readObject();
                setVariable(task, variableName, value, scope, isNew);
                stream.close();

            } else {
                throw new FlowableContentNotSupportedException("Serialized objects are not allowed");
            }

            return getVariableFromRequestWithoutAccessCheck(task, variableName, scope, false);

        } catch (IOException ioe) {
            throw new FlowableIllegalArgumentException("Error getting binary variable", ioe);
        } catch (ClassNotFoundException ioe) {
            throw new FlowableContentNotSupportedException("The provided body contains a serialized object for which the class was not found: " + ioe.getMessage());
        }

    }

    protected RestVariable setSimpleVariable(RestVariable restVariable, Task task, boolean isNew) {
        if (restVariable.getName() == null) {
            throw new FlowableIllegalArgumentException("Variable name is required");
        }

        // Figure out scope, revert to local is omitted
        RestVariableScope scope = restVariable.getVariableScope();
        if (scope == null) {
            scope = RestVariableScope.LOCAL;
        }

        Object actualVariableValue = restResponseFactory.getVariableValue(restVariable);

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Retry the upload ensuring the client sends a well-formed multipart body
  2. Check server/proxy logs for the wrapped IOException cause
  3. Increase proxy/body size limits and timeouts for large binaries
  4. Verify client library multipart encoding (boundary, headers)
  5. Capture the response body which includes the cause message
Defensive patterns

Strategy: retry

Validate before calling

if (fileBuffer.length === 0) throw new Error('refusing to upload empty binary payload');

Try / catch

try { await upload(...) } catch (e) { if (isTransient(e)) return retryWithBackoff(upload); throw new Error('binary upload failed: ' + e.cause); }

Prevention

When it happens

Trigger: POSTing binary variable content where the multipart stream fails mid-read: truncated upload, invalid multipart encoding, network interruption between client and server, or servlet container failing to provide the file part.

Common situations: Proxy or load balancer cutting off large uploads; clients sending chunked/defective multipart bodies; timeouts on slow uploads of large files.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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