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 zero files. A binary task variable is created from the first file in the multipart file map, so at least one file part is mandatory.

Source

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

        if (scope == RestVariableScope.GLOBAL) {
            if (task.getExecutionId() != null && runtimeService.hasVariable(task.getExecutionId(), variableName)) {
                variableFound = true;
            }

        } else if (scope == RestVariableScope.LOCAL) {
            if (taskService.hasVariableLocal(task.getId(), variableName)) {
                variableFound = true;
            }
        }
        return variableFound;
    }

    protected RestVariable setBinaryVariable(MultipartHttpServletRequest request, Task task, boolean isNew) {

        // 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 the file as a multipart file part in the request
  2. Ensure the HTTP client content type is multipart/form-data, not application/json or urlencoded
  3. Check the file exists locally before sending so the client actually attaches it

Example fix

// before
curl -X POST url/variables -F "scope=local"
// after
curl -X POST url/variables -F "scope=local" -F "file=@data.bin"
Defensive patterns

Strategy: validation

Validate before calling

if (file == null || !file.exists()) throw new IllegalStateException("Nothing to upload: file missing");

Try / catch

try { uploadBinaryVariable(taskId, file) } catch (FlowableIllegalArgumentException e) { log.error("Multipart body must contain a file part"); }

Prevention

When it happens

Trigger: POST or PUT /runtime/tasks/{taskId}/variables sent as multipart/form-data with no file part (only form fields, or an empty body).

Common situations: HTTP clients defaulting to urlencoded instead of multipart; a file path that resolved to nothing so no file part was attached; proxy stripping file parts.

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/b18b7299d6629915. Report an issue: GitHub.