flowable/flowable-engine · error · FlowableIllegalArgumentException

No file content was found in request body.

Error message

No file content was found in request body.

What it means

FlowableIllegalArgumentException thrown by setBinaryVariable when the multipart request contains no file entries at all (request.getFileMap() is empty). The endpoint expects at least one file part carrying the variable content.

Source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java:106

                    result = buffer.toByteArray();
                    response.setContentType("application/x-java-serialized-object");
                }

            } else {
                throw new FlowableObjectNotFoundException("The variable does not have a binary data stream.", null);
            }
            return result;

        } catch (IOException ioe) {
            throw new FlowableException("Error getting variable " + variableName, ioe);
        }
    }

    protected RestVariable setBinaryVariable(MultipartHttpServletRequest request, Execution execution, boolean isNew, boolean async) {

        // Validate input and set defaults
        if (request.getFileMap().size() == 0) {
            throw new FlowableIllegalArgumentException("No file content was found in request body.");
        }

        // Get first file in the map, ignore possible other files
        MultipartFile file = request.getFile(request.getFileMap().keySet().iterator().next());

        if (file == null) {
            throw new FlowableIllegalArgumentException("No file content was found in request body.");
        }

        String variableScope = null;
        String variableName = null;
        String variableType = null;

        Map<String, String[]> paramMap = request.getParameterMap();
        for (String parameterName : paramMap.keySet()) {

            if (paramMap.get(parameterName).length > 0) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Attach at least one file part in the multipart request (any part name; first file is used)
  2. Ensure Content-Type is multipart/form-data and the client serializes files as file parts
  3. Catch FlowableIllegalArgumentException and return 400 with guidance on required file part

Example fix

// before
form.field("data", fileBytes); // form field, not a file part
// after
form.add("data", new ByteArrayBody(fileBytes, ContentType.DEFAULT_BINARY, "data.bin"));
HttpPost post = new HttpPost(url);
post.setEntity(MultipartEntityBuilder.create().addPart("data", form).build());
Defensive patterns

Strategy: validation

Validate before calling

if (file == null || file.length() == 0) {
    throw new IllegalArgumentException("multipart request must include a file part");
}

Try / catch

try {
    client.uploadBinaryVariable(executionId, name, file);
} catch (HttpClientErrorException.BadRequest e) {
    // body: No file content was found in request body.
}

Prevention

When it happens

Trigger: POST/PUT to an execution or process-instance variable resource with multipart content-type but zero file parts (only form fields, or empty body).

Common situations: Client sends JSON or urlencoded body to a multipart endpoint; HTTP client library not configured for multipart upload; file part name mismatch causing the file map to be empty.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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