flowable/flowable-engine · error · FlowableIllegalArgumentException

Multipart request is required

Error message

Multipart request is required

What it means

Thrown by PUT /repository/models/{modelId}/source-extra when the request is not a multipart request. The endpoint requires multipart/form-data so the uploaded file can be extracted from the MultipartHttpServletRequest.

Source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/ModelSourceExtraResource.java:82

    @ApiOperation(value = "Set the extra editor source for a model", tags = { "Models" }, nickname = "setExtraEditorSource", consumes = "multipart/form-data",
            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.",
            code = 204)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file", dataType = "file", paramType = "form", required = true)
    })
    @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

  1. Send the request as multipart/form-data with at least one file part (e.g. curl -X PUT -F 'file=@source.xml' ...)
  2. Check the Content-Type header includes the multipart boundary and was not overridden by the HTTP client
  3. Ensure Spring multipart support is enabled in the REST application
  4. Confirm no proxy or filter rewrites the request body/headers

Example fix

// before
curl -X PUT -H 'Content-Type: application/octet-stream' --data-binary @src.xml .../models/id/source-extra
// after
curl -X PUT -F 'file=@src.xml' .../models/id/source-extra
Defensive patterns

Strategy: validation

Validate before calling

if (!contentType.startsWith("multipart/form-data")) throw new IllegalArgumentException("use multipart/form-data with a file part");

Try / catch

try { setModelSource(modelId, request); } catch (FlowableIllegalArgumentException e) { log.error("send multipart/form-data with a file part", e); }

Prevention

When it happens

Trigger: PUT /repository/models/{modelId}/source-extra sent with Content-Type application/octet-stream, application/json, or form-urlencoded instead of multipart/form-data; also occurs when a multipart parser/filter is not configured so the request never becomes a MultipartHttpServletRequest.

Common situations: Client libraries sending raw byte bodies instead of a file part; missing or misconfigured MultipartResolver/multipart servlet config in the REST app; proxies stripping the Content-Type boundary.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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