{"record":{"id":"d1a765e63ac6a3e6","repo":"flowable/flowable-engine","slug":"no-file-content-was-found-in-request-body","errorCode":null,"errorMessage":"No file content was found in request body.","messagePattern":"No file content was found in request body\\.","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseVariableResource.java","lineNumber":308,"sourceCode":"\n        RestVariable variable = null;\n        \n        if (!async) {\n            variable = getVariableFromRequestWithoutAccessCheck(instanceId, restVariable.getName(), variableType, false);\n            \n            // We are setting the scope because the fetched variable does not have it\n            variable.setVariableScope(scope);\n        }\n        \n        return variable;\n    }\n\n    protected RestVariable setBinaryVariable(MultipartHttpServletRequest request, String instanceId, int responseVariableType, boolean isNew,\n            boolean async, RestVariableScope scope, VariableInterceptor variableInterceptor) {\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":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseVariableResource.java#L290-L326","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Send the payload as multipart/form-data with at least one file part, e.g. curl -F \"file=@data.pdf\" .../variables.","Include the variable name/scope/type as form fields alongside the file part.","If the data is not a file, use the JSON variables endpoint instead of the binary one."],"exampleFix":"// before\ncurl -X POST -H \"Content-Type: application/octet-stream\" --data-binary @doc.pdf .../case-instances/{id}/variables\n// after\ncurl -X POST -F \"file=@doc.pdf\" -F \"variableName=doc\" -F \"variableType=binary\" .../case-instances/{id}/variables","handlingStrategy":"validation","validationCode":"const fd = new FormData();\nfd.append('file', blob, 'doc.pdf');\nif (![...fd.keys()].some(k => fd.get(k) instanceof File || fd.get(k) instanceof Blob)) {\n  throw new Error('multipart body must contain a file part');\n}","typeGuard":"function multipartHasFile(req) { return req && req.fileMap && Object.keys(req.fileMap).length > 0; }","tryCatchPattern":"try {\n  await uploadBinaryVariable(id, formData);\n} catch (e) {\n  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');\n  throw e;\n}","preventionTips":["Use curl -F or a real multipart encoder; never --data-binary for this endpoint.","Confirm the request Content-Type is multipart/form-data with a boundary.","Send base64-in-JSON to the JSON endpoint, not the binary one."],"tags":["rest","multipart","validation","binary"],"backgroundTag":"invalid-argument-format","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}