{"record":{"id":"34849449ee7e53d0","repo":"flowable/flowable-engine","slug":"multipart-request-with-file-content-is-required-348494","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-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/DeploymentCollectionResource.java","lineNumber":181,"sourceCode":"            @ApiParam(name = \"deploymentName\") @RequestParam(value = \"deploymentName\", required = false) String deploymentName,\n            @ApiParam(name = \"tenantId\") @RequestParam(value = \"tenantId\", required = false) String tenantId,\n            HttpServletRequest request) {\n\n        if (!(request instanceof MultipartHttpServletRequest)) {\n            throw new FlowableIllegalArgumentException(\"Multipart request is required\");\n        }\n        \n        if (restApiInterceptor != null) {\n            restApiInterceptor.executeNewDeploymentForTenantId(tenantId);\n        }\n\n        String queryString = request.getQueryString();\n        Map<String, String> decodedQueryStrings = splitQueryString(queryString);\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            EventDeploymentBuilder deploymentBuilder = repositoryService.createDeployment();\n            String fileName = file.getOriginalFilename();\n            if (StringUtils.isEmpty(fileName) || !(fileName.endsWith(\".event\") || fileName.endsWith(\".channel\"))) {\n                fileName = file.getName();\n            }\n\n            if (fileName.endsWith(\".event\") || fileName.endsWith(\".channel\")) {\n                try (final InputStream fileInputStream = file.getInputStream()) {\n                    deploymentBuilder.addInputStream(fileName, fileInputStream);\n                }\n                \n            } else {\n                throw new FlowableIllegalArgumentException(\"File must be of type .event, .channel\");","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/DeploymentCollectionResource.java#L163-L199","documentation":"FlowableIllegalArgumentException thrown by uploadDeployment when the request is multipart but the file map is empty — no file part was included. The API needs at least one file to build the EventDeployment.","triggerScenarios":"POSTing multipart/form-data containing only text fields (category, deploymentName, tenantId) with no file part, or the file field name not matching what the server collects into its file map.","commonSituations":"Selecting no file in a UI upload form, curl -F with only non-file fields, or clients sending the file as a raw body/JSON field instead of a proper multipart file part.","solutions":["Attach at least one file part to the multipart request (curl -F \"file=@event-model.json\").","Send the payload as a real multipart file field, not as a JSON body field or raw bytes.","Check client library usage: use form-data/multipart upload helpers rather than string bodies."],"exampleFix":"// before\ncurl -X POST -F \"deploymentName=events\" http://host/event-registry-repository/deployments\n// after\ncurl -X POST -F \"deploymentName=events\" -F \"file=@order-events.json\" http://host/event-registry-repository/deployments","handlingStrategy":"validation","validationCode":"MultipartHttpServletRequest mp = (MultipartHttpServletRequest) request;\nif (mp.getFileMap().isEmpty()) throw new IllegalArgumentException(\"attach at least one file part\");","typeGuard":"boolean hasFilePart = mp.getFileMap() != null && !mp.getFileMap().isEmpty();","tryCatchPattern":"try { upload(file); } catch (FlowableIllegalArgumentException e) { return ResponseEntity.badRequest().body(\"no file part in request\"); }","preventionTips":["Always include a file part named 'file' in deployment uploads","Test uploads with a real file before wiring up forms","Do not send files as JSON fields or raw bodies"],"tags":["rest-api","multipart","upload","empty-payload"],"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-14T05:17:10.506Z"}