{"record":{"id":"0a984c411270b3d5","repo":"flowable/flowable-engine","slug":"multipart-request-with-file-content-is-required-0a984c","errorCode":null,"errorMessage":"Multipart request with file content is required","messagePattern":"Multipart request with file content is required","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/ModelSourceExtraResource.java","lineNumber":88,"sourceCode":"    })\n    @ApiResponses(value = {\n            @ApiResponse(code = 204, message = \"Indicates the model was found and the extra source has been updated.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested model was not found.\")\n    })\n    @PutMapping(value = \"/repository/models/{modelId}/source-extra\", consumes = \"multipart/form-data\")\n    @ResponseStatus(HttpStatus.NO_CONTENT)\n    public void setModelSource(@ApiParam(name = \"modelId\") @PathVariable String modelId, HttpServletRequest request) {\n        Model model = getModelFromRequest(modelId);\n        try {\n\n            if (!(request instanceof MultipartHttpServletRequest)) {\n                throw new FlowableIllegalArgumentException(\"Multipart request is required\");\n            }\n\n            MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;\n\n            if (multipartRequest.getFileMap().size() == 0) {\n                throw new FlowableIllegalArgumentException(\"Multipart request with file content is required\");\n            }\n\n            MultipartFile file = multipartRequest.getFileMap().values().iterator().next();\n\n            repositoryService.addModelEditorSourceExtra(model.getId(), file.getBytes());\n\n        } catch (Exception e) {\n            throw new FlowableException(\"Error adding model editor source extra\", e);\n        }\n    }\n\n}\n","sourceCodeStart":70,"sourceCodeEnd":101,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/ModelSourceExtraResource.java#L70-L101","documentation":"Thrown by PUT /repository/models/{modelId}/source-extra when the request is multipart but contains no file parts (getFileMap().size() == 0). The resource takes the first file part and stores it as the extra editor source, so at least one file is mandatory.","triggerScenarios":"POSTing multipart/form-data with only text fields, empty file parts, or a malformed body where the parser finds no files; e.g. curl -F 'name=x' with no file=@ entry.","commonSituations":"Clients sending multipart with only metadata fields; scripting errors building the form; file paths that failed to resolve so the part was omitted; Content-Disposition not marked as a file part.","solutions":["Include an actual file part in the form (curl -F 'file=@extra.xml')","Verify the file path exists and is readable on the client machine","Inspect the request with a proxy to confirm the file part appears in the body","Check the HTTP client's multipart builder marks the part as a file, not a text field"],"exampleFix":"// before\ncurl -X PUT -F 'description=extra source' .../models/id/source-extra\n// after\ncurl -X PUT -F 'file=@extra.xml' -F 'description=extra source' .../models/id/source-extra","handlingStrategy":"validation","validationCode":"if (!java.nio.file.Files.exists(path)) throw new IllegalArgumentException(\"file part missing/unreadable: \" + path);","typeGuard":null,"tryCatchPattern":"try { setModelSource(modelId, request); } catch (FlowableIllegalArgumentException e) { log.error(\"multipart body had no file part\", e); }","preventionTips":["Always attach the file with -F file=@... (curl) or files= (requests)","Check the client library marks parts as file uploads","Verify the local file path exists before sending"],"tags":["flowable","rest","multipart","validation"],"backgroundTag":"empty-required-field","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}