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

Creating/updating a binary task variable requires a multipart request containing at least one file part. If the multipart request has an empty file map, the API throws FlowableIllegalArgumentException (HTTP 400) because there is no binary content to store.

Solutions

  1. Attach the binary content as a file part in a multipart/form-data request.
  2. Set Content-Type: multipart/form-data in the HTTP client.
  3. Verify the file part name isn't empty and the client actually streams the file (check file size > 0).
  4. Use a JSON variable with base64 via a different endpoint/mechanism if multipart is impractical.

Example fix

// before
curl -X POST /cmmn-runtime/tasks/123/variables -F 'name=doc'
// 400: No file content was found in request body.

// after
curl -X POST /cmmn-runtime/tasks/123/variables -F 'name=doc' -F 'file=@report.pdf'
Defensive patterns

Strategy: validation

Validate before calling

if (!file || file.size === 0) throw new Error('attach a non-empty file for binary variables');

Type guard

const hasFilePart = (fd) => [...fd.entries()].some(([, v]) => v instanceof File && v.size > 0);

Try / catch

try { await api.post(`/cmmn-runtime/tasks/${id}/variables`, form, {headers:{'Content-Type':'multipart/form-data'}}); } catch (e) { if (e.response && e.response.status === 400) { /* ensure file part present */ } throw e; }

Prevention

When it happens

Trigger: POST /cmmn-runtime/tasks/{taskId}/variables (new binary variable) sent as multipart/form-data with no file part at all — only text fields or an empty body.

Common situations: HTTP clients configured to send JSON instead of multipart; file input left empty in the UI; proxy stripping the file part; wrong content-type header (application/x-www-form-urlencoded).

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

Appendix: source

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

        if (scope == RestVariableScope.GLOBAL) {
            if (ScopeTypes.CMMN.equals(task.getScopeType()) && task.getScopeId() != null && runtimeService.hasVariable(task.getScopeId(), 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)