quarkusio/quarkus · error · NotSupportedException
Media type '" + mediaType + "' in multipart request is not s
Error message
Media type '" + mediaType + "' in multipart request is not supported
What it means
MultipartSupport.findReader throws a jakarta.ws.rs.NotSupportedException when reading an incoming multipart part because no MessageBodyReader is readable for the part's declared type and media type. The server cannot deserialize the part body into the target parameter type. This is the inbound (reader) counterpart to the writer lookup errors.
Source
Thrown at independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultipartSupport.java:148
List<MessageBodyReader<?>> readers = serialisers.findReaders(null, type, mediaType, RuntimeType.SERVER);
if (readers.isEmpty()) {
throw new NotSupportedException();
}
for (MessageBodyReader<?> reader : readers) {
if (reader instanceof ServerMessageBodyReader) {
ServerMessageBodyReader<?> serverMessageBodyReader = (ServerMessageBodyReader<?>) reader;
if (serverMessageBodyReader.isReadable(type, genericType, context.getTarget().getLazyMethod(), mediaType)) {
return serverMessageBodyReader;
}
} else {
// TODO: should we be passing in the annotations?
if (reader.isReadable(type, genericType, EMPTY_ANNOTATIONS, mediaType)) {
return reader;
}
}
}
throw new NotSupportedException("Media type '" + mediaType + "' in multipart request is not supported");
}
private static Object read(MessageBodyReader<?> reader, String attributeName, Supplier<InputStream> inputStreamSupplier,
Class type, Type genericType, MediaType mediaType,
ResteasyReactiveRequestContext context) {
try {
if (reader instanceof ServerMessageBodyReader) {
ServerMessageBodyReader<?> serverMessageBodyReader = (ServerMessageBodyReader<?>) reader;
// this should always be an empty stream as multipart doesn't set the request body
InputStream originalInputStream = context.getInputStream();
try {
// we need to set a fake input stream in order to trick the readers into thinking they are reading from the body
context.setInputStream(inputStreamSupplier.get());
return serverMessageBodyReader.readFrom(type, genericType, mediaType, context);
} finally {
context.setInputStream(originalInputStream);
}
} else {View on GitHub (pinned to e1c734241f)
Solutions
- Add quarkus-resteasy-reactive-jackson (or the appropriate reader extension) to the project.
- Set @PartType(MediaType.APPLICATION_JSON) on the input part field so the JSON reader is selected.
- Register a custom MessageBodyReader @Provider for the part type/media type.
- Change the parameter type to something readable (String, InputStream, FileUpload) and parse manually.
Example fix
// before @RestForm MyPojo data; // no reader for text/plain -> MyPojo // after @RestForm @PartType(MediaType.APPLICATION_JSON) public MyPojo data;
Defensive patterns
Strategy: validation
Validate before calling
if (partType == null || partType.equals(MediaType.TEXT_PLAIN) && !String.class.equals(paramType)) { throw new ConfigurationException("unsupported part media type " + partType + " for " + paramType); } Try / catch
try { return readPart(...); } catch (NotSupportedException e) { log.error("no reader for multipart part: " + e.getMessage()); throw new BadRequestException("unsupported part"); } Prevention
- Use @PartType(APPLICATION_JSON) for POJO parts
- Add quarkus-resteasy-reactive-jackson for JSON parts
- Prefer built-in types (String, InputStream, FileUpload) for simple parts
- Register custom readers with @Provider
When it happens
Trigger: A @RestForm / multipart input parameter has a type (e.g. a POJO) whose @PartType media type has no matching MessageBodyReader; missing JSON reader extension for a JSON part.
Common situations: Binding JSON parts to POJOs without quarkus-resteasy-reactive-jackson; custom part types with no reader; mismatched @PartType (e.g. text/plain for a POJO).
Related errors
- Form value is a file
- Form value is a string
- Could not find MessageBodyWriter for ${entityClass} as ${med
- Extra steps left over
- Unsupported value type: %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/8c893def503cfced.
Report an issue: GitHub.