{"record":{"id":"8c893def503cfced","repo":"quarkusio/quarkus","slug":"media-type-mediatype-in-multipart-reques","errorCode":null,"errorMessage":"Media type '\" + mediaType + \"' in multipart request is not supported","messagePattern":"Media type '\" \\+ mediaType \\+ \"' in multipart request is not supported","errorType":"exception","errorClass":"NotSupportedException","httpStatus":415,"severity":"error","filePath":"independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultipartSupport.java","lineNumber":148,"sourceCode":"        List<MessageBodyReader<?>> readers = serialisers.findReaders(null, type, mediaType, RuntimeType.SERVER);\n        if (readers.isEmpty()) {\n            throw new NotSupportedException();\n        }\n\n        for (MessageBodyReader<?> reader : readers) {\n            if (reader instanceof ServerMessageBodyReader) {\n                ServerMessageBodyReader<?> serverMessageBodyReader = (ServerMessageBodyReader<?>) reader;\n                if (serverMessageBodyReader.isReadable(type, genericType, context.getTarget().getLazyMethod(), mediaType)) {\n                    return serverMessageBodyReader;\n                }\n            } else {\n                // TODO: should we be passing in the annotations?\n                if (reader.isReadable(type, genericType, EMPTY_ANNOTATIONS, mediaType)) {\n                    return reader;\n                }\n            }\n        }\n        throw new NotSupportedException(\"Media type '\" + mediaType + \"' in multipart request is not supported\");\n    }\n\n    private static Object read(MessageBodyReader<?> reader, String attributeName, Supplier<InputStream> inputStreamSupplier,\n            Class type, Type genericType, MediaType mediaType,\n            ResteasyReactiveRequestContext context) {\n        try {\n            if (reader instanceof ServerMessageBodyReader) {\n                ServerMessageBodyReader<?> serverMessageBodyReader = (ServerMessageBodyReader<?>) reader;\n                // this should always be an empty stream as multipart doesn't set the request body\n                InputStream originalInputStream = context.getInputStream();\n                try {\n                    // we need to set a fake input stream in order to trick the readers into thinking they are reading from the body\n                    context.setInputStream(inputStreamSupplier.get());\n                    return serverMessageBodyReader.readFrom(type, genericType, mediaType, context);\n                } finally {\n                    context.setInputStream(originalInputStream);\n                }\n            } else {","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultipartSupport.java#L130-L166","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":"// before\n@RestForm MyPojo data; // no reader for text/plain -> MyPojo\n// after\n@RestForm\n@PartType(MediaType.APPLICATION_JSON)\npublic MyPojo data;","handlingStrategy":"validation","validationCode":"if (partType == null || partType.equals(MediaType.TEXT_PLAIN) && !String.class.equals(paramType)) { throw new ConfigurationException(\"unsupported part media type \" + partType + \" for \" + paramType); }","typeGuard":null,"tryCatchPattern":"try { return readPart(...); } catch (NotSupportedException e) { log.error(\"no reader for multipart part: \" + e.getMessage()); throw new BadRequestException(\"unsupported part\"); }","preventionTips":["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"],"tags":["rest","multipart","deserialization"],"backgroundTag":"unsupported-media-type","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}