flowable/flowable-engine · error · FlowableIllegalArgumentException

Multipart request with file content is required

Error message

Multipart request with file content is required

What it means

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.

Source

Thrown at modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/DeploymentCollectionResource.java:181

            @ApiParam(name = "deploymentName") @RequestParam(value = "deploymentName", required = false) String deploymentName,
            @ApiParam(name = "tenantId") @RequestParam(value = "tenantId", required = false) String tenantId,
            HttpServletRequest request) {

        if (!(request instanceof MultipartHttpServletRequest)) {
            throw new FlowableIllegalArgumentException("Multipart request is required");
        }
        
        if (restApiInterceptor != null) {
            restApiInterceptor.executeNewDeploymentForTenantId(tenantId);
        }

        String queryString = request.getQueryString();
        Map<String, String> decodedQueryStrings = splitQueryString(queryString);

        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;

        if (multipartRequest.getFileMap().size() == 0) {
            throw new FlowableIllegalArgumentException("Multipart request with file content is required");
        }

        MultipartFile file = multipartRequest.getFileMap().values().iterator().next();

        try {
            EventDeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
            String fileName = file.getOriginalFilename();
            if (StringUtils.isEmpty(fileName) || !(fileName.endsWith(".event") || fileName.endsWith(".channel"))) {
                fileName = file.getName();
            }

            if (fileName.endsWith(".event") || fileName.endsWith(".channel")) {
                try (final InputStream fileInputStream = file.getInputStream()) {
                    deploymentBuilder.addInputStream(fileName, fileInputStream);
                }
                
            } else {
                throw new FlowableIllegalArgumentException("File must be of type .event, .channel");

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Attach at least one file part to the multipart request (curl -F "file=@event-model.json").
  2. Send the payload as a real multipart file field, not as a JSON body field or raw bytes.
  3. Check client library usage: use form-data/multipart upload helpers rather than string bodies.

Example fix

// before
curl -X POST -F "deploymentName=events" http://host/event-registry-repository/deployments
// after
curl -X POST -F "deploymentName=events" -F "file=@order-events.json" http://host/event-registry-repository/deployments
Defensive patterns

Strategy: validation

Validate before calling

MultipartHttpServletRequest mp = (MultipartHttpServletRequest) request;
if (mp.getFileMap().isEmpty()) throw new IllegalArgumentException("attach at least one file part");

Type guard

boolean hasFilePart = mp.getFileMap() != null && !mp.getFileMap().isEmpty();

Try / catch

try { upload(file); } catch (FlowableIllegalArgumentException e) { return ResponseEntity.badRequest().body("no file part in request"); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/34849449ee7e53d0. Report an issue: GitHub.