quarkusio/quarkus · error · IllegalStateException
Failed to find multipart data for class " + responseClass +
Error message
Failed to find multipart data for class " + responseClass + ". If it's meant to be used as multipart response type, consider annotating it with @MultipartForm
What it means
The client received a multipart response whose target class is not registered in the build-time-generated multipartDataMap. Multipart DTO classes must be discovered at build time (annotated with @MultipartForm so the processor generates MultipartResponseData for them); at runtime the lookup by class fails and mapToResponse throws IllegalStateException.
Source
Thrown at independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientResponseCompleteRestHandler.java:86
GenericType<?> responseType = context.getResponseType();
if (EntityPartImpl.isEntityPartList(responseType.getType())) {
Serialisers serialisers = context.getRestClient().getClientContext().getSerialisers();
List<EntityPart> entityParts = new ArrayList<>();
for (InterfaceHttpData httpData : context.getResponseMultipartParts()) {
entityParts.add(nettyPartToEntityPart(httpData, serialisers));
}
builder.entity(entityParts);
} else {
if (!(responseType.getType() instanceof Class)) {
throw new IllegalArgumentException("Not supported return type for a multipart message, " +
"expected a non-generic class got : " + responseType.getType());
}
Class<?> responseClass = (Class<?>) responseType.getType();
MultipartResponseData multipartData = multipartDataMap.get(responseClass);
if (multipartData == null) {
throw new IllegalStateException("Failed to find multipart data for class " + responseClass + ". " +
"If it's meant to be used as multipart response type, consider annotating it with @MultipartForm");
}
Object result = multipartData.newInstance();
builder.entity(result);
List<InterfaceHttpData> parts = context.getResponseMultipartParts();
for (InterfaceHttpData httpData : parts) {
FieldFiller fieldFiller = null;
// find the correct filler
for (FieldFiller ff : multipartData.getFieldFillers()) {
if (ff.getPartName().equals(httpData.getName())) {
fieldFiller = ff;
break;
}
}
if (fieldFiller == null) {
continue;
}
if (httpData instanceof Attribute at) {View on GitHub (pinned to e1c734241f)
Solutions
- Annotate the response POJO with @MultipartForm and annotate its fields appropriately (@RestForm, @RestForm(FileUpload) etc.).
- Rebuild/restart the application so the multipart processor regenerates MultipartResponseData for the class.
- Ensure the DTO class is part of the application's Jandex index (in-app class, or indexed dependency).
- Handle the response manually as a List<EntityPart> or raw body if you cannot annotate the class.
Example fix
// before
class FormData { String name; File file; }
// after
@MultipartForm
class FormData {
@RestForm String name;
@RestForm File file;
} Defensive patterns
Strategy: validation
Validate before calling
// Multipart response DTO must be annotated
static void checkMultipartDto(Class<?> dto) {
if (dto.getAnnotation(MultipartForm.class) == null) {
throw new IllegalStateException(dto + " must be annotated with @MultipartForm");
}
} Prevention
- Annotate every multipart response POJO with @MultipartForm
- Rebuild the app after adding new multipart DTOs
- Keep multipart DTOs in the application (or an indexed dependency)
When it happens
Trigger: Declaring a client method with @Produces("multipart/form-data") returning a POJO that is not annotated with @MultipartForm (or the annotation is missing on the client-side signature), so no MultipartResponseData was generated for the class.
Common situations: Sharing response DTOs from a library without the annotation; adding a new multipart endpoint and forgetting the annotation; running against a stale build where the generated multipart data predates the new DTO class.
Related errors
- Not supported return type for a multipart message, expected
- Unsupported multipart message element type. Expected FileAtt
- PartType annotation is only supported on fields and (setter/
- Primitive types are not supported for multipart response map
- Unsupported field type for multipart response mapping: " + t
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/baf3733f8f1ed51d.
Report an issue: GitHub.