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 a multipart request to create/set a binary variable contains no file parts (request.getFileMap() is empty). Binary variables are uploaded as multipart file content.

Source

Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseVariableResource.java:308

        RestVariable variable = null;
        
        if (!async) {
            variable = getVariableFromRequestWithoutAccessCheck(instanceId, restVariable.getName(), variableType, false);
            
            // We are setting the scope because the fetched variable does not have it
            variable.setVariableScope(scope);
        }
        
        return variable;
    }

    protected RestVariable setBinaryVariable(MultipartHttpServletRequest request, String instanceId, int responseVariableType, boolean isNew,
            boolean async, RestVariableScope scope, VariableInterceptor variableInterceptor) {

        // 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. Send the payload as multipart/form-data with at least one file part, e.g. curl -F "file=@data.pdf" .../variables.
  2. Include the variable name/scope/type as form fields alongside the file part.
  3. If the data is not a file, use the JSON variables endpoint instead of the binary one.

Example fix

// before
curl -X POST -H "Content-Type: application/octet-stream" --data-binary @doc.pdf .../case-instances/{id}/variables
// after
curl -X POST -F "file=@doc.pdf" -F "variableName=doc" -F "variableType=binary" .../case-instances/{id}/variables
Defensive patterns

Strategy: validation

Validate before calling

const fd = new FormData();
fd.append('file', blob, 'doc.pdf');
if (![...fd.keys()].some(k => fd.get(k) instanceof File || fd.get(k) instanceof Blob)) {
  throw new Error('multipart body must contain a file part');
}

Type guard

function multipartHasFile(req) { return req && req.fileMap && Object.keys(req.fileMap).length > 0; }

Try / catch

try {
  await uploadBinaryVariable(id, formData);
} catch (e) {
  if (/No file content was found/.test(e.message)) throw new Error('Send multipart/form-data with a file part, not raw bytes or JSON');
  throw e;
}

Prevention

When it happens

Trigger: POST/PUT .../variables with Content-Type multipart/form-data but zero file parts (only form fields, or body sent as application/octet-stream / JSON instead of multipart).

Common situations: Client uploads raw bytes without multipart wrapping; curl -F not used (e.g. --data-binary instead); frontend sends base64 in JSON to the binary endpoint.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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