{"record":{"id":"a2ddb763b43fe595","repo":"flowable/flowable-engine","slug":"no-file-content-was-found-in-request-body-a2ddb7","errorCode":null,"errorMessage":"No file content was found in request body.","messagePattern":"No file content was found in request body\\.","errorType":"http","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskVariableBaseResource.java","lineNumber":128,"sourceCode":"\n        if (scope == RestVariableScope.GLOBAL) {\n            if (ScopeTypes.CMMN.equals(task.getScopeType()) && task.getScopeId() != null && runtimeService.hasVariable(task.getScopeId(), variableName)) {\n                variableFound = true;\n            }\n\n        } else if (scope == RestVariableScope.LOCAL) {\n            if (taskService.hasVariableLocal(task.getId(), variableName)) {\n                variableFound = true;\n            }\n        }\n        return variableFound;\n    }\n\n    protected RestVariable setBinaryVariable(MultipartHttpServletRequest request, Task task, boolean isNew) {\n\n        // Validate input and set defaults\n        if (request.getFileMap().size() == 0) {\n            throw new FlowableIllegalArgumentException(\"No file content was found in request body.\");\n        }\n\n        // Get first file in the map, ignore possible other files\n        MultipartFile file = request.getFile(request.getFileMap().keySet().iterator().next());\n\n        if (file == null) {\n            throw new FlowableIllegalArgumentException(\"No file content was found in request body.\");\n        }\n\n        String variableScope = null;\n        String variableName = null;\n        String variableType = null;\n\n        Map<String, String[]> paramMap = request.getParameterMap();\n        for (String parameterName : paramMap.keySet()) {\n\n            if (paramMap.get(parameterName).length > 0) {\n","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskVariableBaseResource.java#L110-L146","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Attach the binary content as a file part in a multipart/form-data request.","Set Content-Type: multipart/form-data in the HTTP client.","Verify the file part name isn't empty and the client actually streams the file (check file size > 0).","Use a JSON variable with base64 via a different endpoint/mechanism if multipart is impractical."],"exampleFix":"// before\ncurl -X POST /cmmn-runtime/tasks/123/variables -F 'name=doc'\n// 400: No file content was found in request body.\n\n// after\ncurl -X POST /cmmn-runtime/tasks/123/variables -F 'name=doc' -F 'file=@report.pdf'","handlingStrategy":"validation","validationCode":"if (!file || file.size === 0) throw new Error('attach a non-empty file for binary variables');","typeGuard":"const hasFilePart = (fd) => [...fd.entries()].some(([, v]) => v instanceof File && v.size > 0);","tryCatchPattern":"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; }","preventionTips":["Always send multipart/form-data with a file part for binary variables","Verify the file input isn't empty before submit","Avoid proxies/transformers that strip file parts"],"tags":["rest-api","cmmn","multipart","binary-variable"],"backgroundTag":"missing-required-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}