{"record":{"id":"5438068a5161ce8f","repo":"flowable/flowable-engine","slug":"multipart-request-with-file-content-is-required-543806","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-dmn-rest/src/main/java/org/flowable/dmn/rest/service/api/repository/DmnDeploymentCollectionResource.java","lineNumber":169,"sourceCode":"    @ApiImplicitParams({\n        @ApiImplicitParam(name=\"file\", paramType = \"form\", dataType = \"java.io.File\")\n    })\n    @PostMapping(value = \"/dmn-repository/deployments\", produces = \"application/json\", consumes = \"multipart/form-data\")\n    @ResponseStatus(HttpStatus.CREATED)\n    public DmnDeploymentResponse uploadDeployment(@ApiParam(name = \"tenantId\") @RequestParam(value = \"tenantId\", required = false) String tenantId, 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        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            DmnDeploymentBuilder deploymentBuilder = dmnRepositoryService.createDeployment();\n            String fileName = file.getOriginalFilename();\n            if (StringUtils.isEmpty(fileName) || !DmnResourceUtil.isDmnResource(fileName)) {\n                fileName = file.getName();\n            }\n\n            if (DmnResourceUtil.isDmnResource(fileName)) {\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 .dmn\");","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-rest/src/main/java/org/flowable/dmn/rest/service/api/repository/DmnDeploymentCollectionResource.java#L151-L187","documentation":"The request was recognized as multipart but contained zero file parts. The handler requires at least one file in the multipart map because the first file becomes the DMN deployment resource, and throws FlowableIllegalArgumentException otherwise.","triggerScenarios":"POST /dmn-repository/deployments as multipart/form-data containing only text fields (e.g. tenantId) and no file part, or an empty file part map because the client sent the file as a plain field instead of a file part.","commonSituations":"curl -F 'file=decision.dmn' (string, not @file), forms where the file input was left empty, or clients using x-www-form-urlencoded field names in a multipart body.","solutions":["Attach the DMN file as a proper file part: curl -F 'file=@decision.dmn'.","In Java clients use a MultipartBody/FilePart (e.g. RestTemplate with MultiValueMap containing a ByteArrayResource/FileSystemResource).","Validate on the client that the file input is non-empty before submitting the form.","Check the multipart field is registered as type 'file', not a text field."],"exampleFix":"// before\nconst form = new FormData(); form.append('file', document.querySelector('input').value);\n// after\nconst input = document.querySelector('input[type=file]');\nif (!input.files.length) throw new Error('select a .dmn file');\nconst form = new FormData(); form.append('file', input.files[0]);","handlingStrategy":"validation","validationCode":"const input = document.querySelector('input[type=file]');\nif (!input || input.files.length === 0) throw new Error('attach a .dmn file before submitting');","typeGuard":null,"tryCatchPattern":"try { return await deploy(multipartRequest); }\ncatch (e) { if (e.status === 400 && /file content is required/.test(e.message)) { alert('Select a file to deploy'); } throw e; }","preventionTips":["Append the File object, not a filename string, to FormData","Validate the form has a selected file before submit","Register the multipart field as a file part","Test deployments with curl -F 'file=@...' first"],"tags":["rest-api","multipart","validation","empty-file"],"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"}