flowable/flowable-engine · error · FlowableException
Error getting file bytes
Error message
Error getting file bytes
What it means
getFileBytes wraps any exception thrown by MultipartFile.getBytes() (e.g. IOException while reading the uploaded file from its temporary storage) in a FlowableException with the message 'Error getting file bytes'. It is thrown from the REST layer when the raw bytes of an uploaded deployment file cannot be read. The original cause is attached as the exception cause.
Solutions
- Check that the servlet container's temp directory (java.io.tmpdir / multipart location) exists, is writable, and has free space
- Verify multipart configuration (spring.servlet.multipart max-file-size/max-request-size, location) matches the upload size
- Inspect the cause chain of the FlowableException (getCause()) for the real IOException and fix that root cause
- Retry the upload; if the temp file was removed by an external cleanup job, exclude the multipart temp dir from that job
Example fix
// before: server just sees FlowableException with no cause handling
try {
byte[] data = file.getBytes();
} catch (IOException e) {
log.error("Upload read failed", e); // surface real cause; ensure temp dir is writable
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
if (file == null || file.isEmpty()) throw new IllegalArgumentException("Uploaded file is empty"); Type guard
boolean isReadable(MultipartFile f) { return f != null && !f.isEmpty(); } Try / catch
try {
byte[] bytes = file.getBytes();
} catch (FlowableException e) {
logger.error("Failed reading uploaded file", e.getCause());
return ResponseEntity.status(502).body("Upload read failed: check temp dir");
} Prevention
- Ensure the servlet container temp directory exists, is writable, and is excluded from tmp-cleanup jobs
- Set multipart max-file-size/max-request-size to accommodate expected uploads
- Call file.getBytes() once, before any other code consumes the request input stream
When it happens
Trigger: Calling a REST endpoint that accepts a MultipartFile (e.g. model/deployment upload) where file.getBytes() throws — most commonly because the underlying temporary upload file was deleted, the temp directory is unwritable/full, or the request content was already consumed.
Common situations: Servlet container temp directory cleaned up mid-request (aggressive tmpwatch/systemd-tmpfiles), disk full on /tmp, multipart resolver misconfiguration, or very large uploads hitting container limits so the part data is unavailable.
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
- Couldn't read file
- Error converting resource stream
- Error converting resource stream
- Error creating attachment data
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/1a24c750591ec699.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/BaseModelSourceResource.java:29
* limitations under the License.
*/
package org.flowable.rest.service.api.repository;
import org.flowable.common.engine.api.FlowableException;
import org.springframework.web.multipart.MultipartFile;
/**
* @author Tijs Rademakers
*/
public abstract class BaseModelSourceResource extends BaseModelResource {
public byte[] getFileBytes(MultipartFile file) {
byte[] byteArray = null;
try {
byteArray = file.getBytes();
} catch (Exception e) {
throw new FlowableException("Error getting file bytes", e);
}
return byteArray;
}
}
View on GitHub (pinned to d6d39ce1c6)