flowable/flowable-engine · error · FlowableIllegalArgumentException
Multipart request with file content is required
Error message
Multipart request with file content is required
What it means
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.
Source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/ModelSourceExtraResource.java:88
})
@ApiResponses(value = {
@ApiResponse(code = 204, message = "Indicates the model was found and the extra source has been updated."),
@ApiResponse(code = 404, message = "Indicates the requested model was not found.")
})
@PutMapping(value = "/repository/models/{modelId}/source-extra", consumes = "multipart/form-data")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void setModelSource(@ApiParam(name = "modelId") @PathVariable String modelId, HttpServletRequest request) {
Model model = getModelFromRequest(modelId);
try {
if (!(request instanceof MultipartHttpServletRequest)) {
throw new FlowableIllegalArgumentException("Multipart request is required");
}
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();
repositoryService.addModelEditorSourceExtra(model.getId(), file.getBytes());
} catch (Exception e) {
throw new FlowableException("Error adding model editor source extra", e);
}
}
}
View on GitHub (pinned to d6d39ce1c6)
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
Example fix
// before curl -X PUT -F 'description=extra source' .../models/id/source-extra // after curl -X PUT -F 'file=@extra.xml' -F 'description=extra source' .../models/id/source-extra
Defensive patterns
Strategy: validation
Validate before calling
if (!java.nio.file.Files.exists(path)) throw new IllegalArgumentException("file part missing/unreadable: " + path); Try / catch
try { setModelSource(modelId, request); } catch (FlowableIllegalArgumentException e) { log.error("multipart body had no file part", e); } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
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
- Multipart request is required
- Multipart request is required
- Multipart request with file content is required
- Multipart request is required
- Multipart request with file content is required
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/0a984c411270b3d5.
Report an issue: GitHub.