{"record":{"id":"601939411e3a0c6e","repo":"quarkusio/quarkus","slug":"could-not-find-messagebodywriter-for-601939","errorCode":null,"errorMessage":"Could not find MessageBodyWriter for ","messagePattern":"Could not find MessageBodyWriter for ","errorType":"http","errorClass":"InternalServerErrorException","httpStatus":500,"severity":"error","filePath":"independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/serialization/MediaTypeDelegatingEntityWriter.java","lineNumber":31,"sourceCode":" * An entity writer that will delegate based on the actual type of the\n * returned entity.\n */\npublic class MediaTypeDelegatingEntityWriter implements EntityWriter {\n\n    private final Map<MediaType, EntityWriter> typeMap;\n\n    public MediaTypeDelegatingEntityWriter(Map<MediaType, EntityWriter> typeMap) {\n        this.typeMap = typeMap;\n    }\n\n    @Override\n    public void write(ResteasyReactiveRequestContext context, Object entity) throws IOException {\n        EntityWriter delegate = typeMap.get(context.getResponseMediaType());\n        if (delegate != null) {\n            delegate.write(context, entity);\n            return;\n        }\n        throw new InternalServerErrorException(\"Could not find MessageBodyWriter for \" + entity.getClass(),\n                Response.serverError().build());\n    }\n}\n","sourceCodeStart":13,"sourceCodeEnd":35,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/serialization/MediaTypeDelegatingEntityWriter.java#L13-L35","documentation":"MediaTypeDelegatingEntityWriter picks a delegate writer keyed by the response media type at runtime. If the negotiated response media type has no entry in the type map, no writer can be chosen and an InternalServerErrorException (500) is thrown.","triggerScenarios":"The response media type resolved for the request (from Accept negotiation or @Produces) is not one of the media types the build-time selected writers support, e.g. client Accepts application/xml but only a JSON writer was wired.","commonSituations":"Client requesting a media type the endpoint doesn't truly support while no 406 path applies; wildcard or unusual media types in Accept; @Produces set mismatched with installed serializer extensions.","solutions":["Install a writer for the requested media type (e.g. add quarkus-rest-jackson for application/json, quarkus-rest-easy-... jaxb for xml).","Fix the client's Accept header to one of the @Produces types the endpoint supports.","Adjust the endpoint's @Produces to match an available writer.","Verify with a single explicit Accept header in tests to see which media types actually resolve."],"exampleFix":"// before\n// client\ncurl -H 'Accept: application/xml' /endpoint   // only JSON writer installed\n// after\ncurl -H 'Accept: application/json' /endpoint","handlingStrategy":"validation","validationCode":"// pre-check: only send Accept types the endpoint @Produces\nSet<String> supported = Set.of(\"application/json\", \"text/plain\");\nif (!supported.contains(requestedAccept)) {\n    requestedAccept = \"application/json\"; // or send Accept: */*\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Align client Accept headers with endpoint @Produces.","Send 'Accept: */*' when media type doesn't matter.","Install writer extensions for every media type you advertise."],"tags":["resteasy-reactive","serialization","content-negotiation","http-500"],"backgroundTag":"no-messagebodywriter-for-entity","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}