flowable/flowable-engine · error · FlowableIllegalArgumentException
Could not process multipart content
Error message
Could not process multipart content
What it means
FlowableIllegalArgumentException wrapping an IOException from processing the multipart request body in setBinaryVariable. Reading the uploaded file stream (file.getInputStream()) or other multipart I/O failed, so the variable could not be stored; the original IOException is preserved as cause.
Source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java:185
stream.close();
} else {
throw new FlowableContentNotSupportedException("Serialized objects are not allowed");
}
RestVariable variable = null;
if (!async) {
variable = getVariableFromRequestWithoutAccessCheck(execution, variableName, scope, false);
// We are setting the scope because the fetched variable does not have it
variable.setVariableScope(scope);
}
return variable;
} catch (IOException ioe) {
throw new FlowableIllegalArgumentException("Could not process multipart content", 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, Execution execution, boolean isNew, boolean async) {
if (restVariable.getName() == null) {
throw new FlowableIllegalArgumentException("Variable name is required");
}
// Figure out scope, revert to local if omitted
RestVariableScope scope = restVariable.getVariableScope();
if (scope == null) {
scope = RestVariableScope.LOCAL;
}
Object actualVariableValue = restResponseFactory.getVariableValue(restVariable);View on GitHub (pinned to d6d39ce1c6)
Solutions
- Check the wrapped IOException cause — usually container temp-dir or stream failure
- Verify the servlet container's multipart temp directory exists and is writable
- Increase max multipart/file size limits (server max-file-size, spring multipart settings)
- Retry the upload with a complete, untruncated request body
Example fix
// before // server: default temp dir, no size config // after # application.properties spring.servlet.multipart.max-file-size=20MB spring.servlet.multipart.max-request-size=25MB
Defensive patterns
Strategy: try-catch
Validate before calling
if (!file.exists() || file.length() == 0) throw new IllegalArgumentException("empty upload rejected before send");
// and confirm server limits accept the size before uploading Try / catch
try {
client.uploadBinaryVariable(executionId, name, file);
} catch (HttpClientErrorException.BadRequest e) {
log.error("multipart processing failed", e);
// check server temp dir / size limits, then retry
} Prevention
- Keep server multipart temp storage healthy and writable
- Set explicit multipart size limits on both client and server
- Ensure uploads complete without client-side aborts
- Retry transient upload failures with backoff
When it happens
Trigger: Binary variable upload where obtaining/reading the MultipartFile stream throws IOException — interrupted upload, temp-dir failure, container-level multipart parsing errors.
Common situations: Servlet container temp directory full or read-only; request aborted by client mid-upload; multipart size limits causing premature stream termination; misconfigured multipart resolver.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Could not process multipart content
- Error getting binary variable
- Multipart request is required
- Multipart request with file content is required
- No file content was found in request body.
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/6f408f2aa3417c03.
Report an issue: GitHub.