{"record":{"id":"7b342063728a855c","repo":"quarkusio/quarkus","slug":"notsupportedexception","errorCode":null,"errorMessage":"NotSupportedException","messagePattern":"NotSupportedException","errorType":"http","errorClass":"NotSupportedException","httpStatus":415,"severity":"error","filePath":"independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/ReaderInterceptorContextImpl.java","lineNumber":48,"sourceCode":"\n    public ReaderInterceptorContextImpl(ResteasyReactiveRequestContext context, Annotation[] annotations, Class<?> type,\n            Type genericType, MediaType mediaType, MessageBodyReader reader, InputStream inputStream,\n            ReaderInterceptor[] interceptors, ServerSerialisers serialisers) {\n        super(context, annotations, type, genericType, mediaType, serialisers);\n        this.reader = reader;\n        this.inputStream = inputStream;\n        this.interceptors = interceptors;\n        this.headers.putAll(context.getHttpHeaders().getRequestHeaders());\n    }\n\n    @Override\n    public Object proceed() throws IOException, WebApplicationException {\n        if (index == interceptors.length) {\n            MessageBodyReader effectiveReader = reader;\n            if (rediscoveryNeeded) {\n                List<MessageBodyReader<?>> readers = serialisers.findReaders(null, type, mediaType, RuntimeType.SERVER);\n                if (readers.isEmpty()) {\n                    throw new NotSupportedException();\n                }\n                effectiveReader = readers.get(0);\n            }\n            return effectiveReader.readFrom(type, genericType, annotations, mediaType, headers, inputStream);\n        } else {\n            return interceptors[index++].aroundReadFrom(this);\n        }\n    }\n\n    @Override\n    public InputStream getInputStream() {\n        return inputStream;\n    }\n\n    @Override\n    public void setInputStream(InputStream is) {\n        this.inputStream = is;\n    }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/ReaderInterceptorContextImpl.java#L30-L66","documentation":"NotSupportedException (HTTP 405/406 family) is thrown by ReaderInterceptorContextImpl.proceed() when, after re-discovering message body readers for the requested type and media type, no MessageBodyReader is found. It means the server has no provider capable of deserializing the request body into the target Java type for the given Content-Type.","triggerScenarios":"A ReaderInterceptor chain reaches the end and rediscoveryNeeded is true (the original reader was invalidated, e.g. after an interceptor changed the type or media type), and serialisers.findReaders() returns an empty list for (type, mediaType, SERVER).","commonSituations":"Client sends a request body with a Content-Type the endpoint cannot consume (e.g. text/plain into a JSON-mapped POJO); a custom ReaderInterceptor modifies the media type or generic type so the pre-selected reader no longer applies; missing JSON extension (quarkus-rest-jackson) so only a few built-in readers exist.","solutions":["Add/register a MessageBodyReader for the type+mediaType pair (e.g. include quarkus-rest-jackson or quarkus-rest-jsonb).","Make the client send a Content-Type matching an @Consumes value of the resource method.","Fix the custom ReaderInterceptor so it does not change the type/mediaType to something unsupported, or avoid forcing rediscovery.","Check the resource method's @Consumes annotation includes the incoming media type."],"exampleFix":"// before (client)\ncurl -H 'Content-Type: text/plain' -d '{\"name\":\"a\"}' /api/items\n// after\ncurl -H 'Content-Type: application/json' -d '{\"name\":\"a\"}' /api/items","handlingStrategy":"validation","validationCode":"// client side: ensure Content-Type matches what the endpoint can read\nif (!contentType.equals(MediaType.APPLICATION_JSON)) {\n    throw new IllegalArgumentException(\"Endpoint only accepts application/json\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    return interceptorContext.proceed();\n} catch (NotSupportedException e) {\n    throw new WebApplicationException(\"Unsupported media type for body\", 415);\n}","preventionTips":["Always send an explicit, correct Content-Type header","Include a JSON provider extension (quarkus-rest-jackson/jsonb)","Keep ReaderInterceptors from mutating type or mediaType","Verify @Consumes on the resource covers all client media types"],"tags":["resteasy-reactive","jaxrs","messagebodyreader","content-negotiation"],"backgroundTag":"no-message-body-reader","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"}