{"record":{"id":"863a2e93c2c8ab3b","repo":"flowable/flowable-engine","slug":"multipart-request-is-required-863a2e","errorCode":null,"errorMessage":"Multipart request is required","messagePattern":"Multipart request is required","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/ModelSourceResource.java","lineNumber":82,"sourceCode":"        return editorSource;\n    }\n\n    @ApiOperation(value = \"Set the editor source for a model\", tags = { \"Models\" }, consumes = \"multipart/form-data\",\n            notes = \"Response body contains the model’s raw editor source. The response’s content-type is set to application/octet-stream, regardless of the content of the source.\",\n            code = 204)\n    @ApiImplicitParams({\n            @ApiImplicitParam(name = \"file\", dataType = \"file\", paramType = \"form\", required = true)\n    })\n    @ApiResponses(value = {\n            @ApiResponse(code = 204, message = \"Indicates the model was found and the source has been updated.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested model was not found.\")\n    })\n    @PutMapping(value = \"/repository/models/{modelId}/source\", 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        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        try {\n            repositoryService.addModelEditorSource(model.getId(), file.getBytes());\n        } catch (Exception e) {\n            throw new FlowableException(\"Error adding model editor source extra\", e);\n        }\n    }\n}\n","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/ModelSourceResource.java#L64-L100","documentation":"Thrown by PUT /repository/models/{modelId}/source when the incoming HttpServletRequest is not a MultipartHttpServletRequest. The endpoint consumes multipart/form-data and needs the file part to store as the model's editor source.","triggerScenarios":"PUT /repository/models/{modelId}/source with Content-Type other than multipart/form-data (e.g. application/octet-stream, text/plain); multipart support not configured so Spring never wraps the request.","commonSituations":"HTTP clients defaulting to raw bodies; missing multipart config in the REST app; gateways rewriting Content-Type and dropping the boundary.","solutions":["Send the request as multipart/form-data with a file part (curl -X PUT -F 'file=@source.xml' ...)","Do not override Content-Type manually when the client builds the multipart body","Ensure Spring multipart resolution is enabled in the Flowable REST application","Check intermediaries are not stripping multipart headers"],"exampleFix":"// before\nrequests.put(url, data=open('src.xml','rb'), headers={'Content-Type':'application/octet-stream'})\n// after\nrequests.put(url, files={'file': open('src.xml','rb')})","handlingStrategy":"validation","validationCode":"if (!\"multipart/form-data\".equals(request.getContentType().split(\";\")[0])) throw new IllegalArgumentException(\"PUT source requires multipart/form-data\");","typeGuard":null,"tryCatchPattern":"try { setModelSource(modelId, request); } catch (FlowableIllegalArgumentException e) { log.error(\"resend as multipart/form-data with file part\", e); }","preventionTips":["Use client helpers that build multipart bodies","Never hardcode Content-Type for uploads","Confirm Spring multipart config before deploying the REST app"],"tags":["flowable","rest","multipart","validation"],"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-14T11:17:12.474Z"}