{"record":{"id":"baf3733f8f1ed51d","repo":"quarkusio/quarkus","slug":"failed-to-find-multipart-data-for-class-respon","errorCode":null,"errorMessage":"Failed to find multipart data for class \" + responseClass + \". If it's meant to be used as multipart response type, consider annotating it with @MultipartForm","messagePattern":"Failed to find multipart data for class \" \\+ responseClass \\+ \"\\. If it's meant to be used as multipart response type, consider annotating it with @MultipartForm","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientResponseCompleteRestHandler.java","lineNumber":86,"sourceCode":"                GenericType<?> responseType = context.getResponseType();\n\n                if (EntityPartImpl.isEntityPartList(responseType.getType())) {\n                    Serialisers serialisers = context.getRestClient().getClientContext().getSerialisers();\n                    List<EntityPart> entityParts = new ArrayList<>();\n                    for (InterfaceHttpData httpData : context.getResponseMultipartParts()) {\n                        entityParts.add(nettyPartToEntityPart(httpData, serialisers));\n                    }\n                    builder.entity(entityParts);\n                } else {\n\n                    if (!(responseType.getType() instanceof Class)) {\n                        throw new IllegalArgumentException(\"Not supported return type for a multipart message, \" +\n                                \"expected a non-generic class got : \" + responseType.getType());\n                    }\n                    Class<?> responseClass = (Class<?>) responseType.getType();\n                    MultipartResponseData multipartData = multipartDataMap.get(responseClass);\n                    if (multipartData == null) {\n                        throw new IllegalStateException(\"Failed to find multipart data for class \" + responseClass + \". \" +\n                                \"If it's meant to be used as multipart response type, consider annotating it with @MultipartForm\");\n                    }\n                    Object result = multipartData.newInstance();\n                    builder.entity(result);\n                    List<InterfaceHttpData> parts = context.getResponseMultipartParts();\n                    for (InterfaceHttpData httpData : parts) {\n                        FieldFiller fieldFiller = null;\n                        // find the correct filler\n                        for (FieldFiller ff : multipartData.getFieldFillers()) {\n                            if (ff.getPartName().equals(httpData.getName())) {\n                                fieldFiller = ff;\n                                break;\n                            }\n                        }\n                        if (fieldFiller == null) {\n                            continue;\n                        }\n                        if (httpData instanceof Attribute at) {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientResponseCompleteRestHandler.java#L68-L104","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nclass FormData { String name; File file; }\n// after\n@MultipartForm\nclass FormData {\n  @RestForm String name;\n  @RestForm File file;\n}","handlingStrategy":"validation","validationCode":"// Multipart response DTO must be annotated\nstatic void checkMultipartDto(Class<?> dto) {\n  if (dto.getAnnotation(MultipartForm.class) == null) {\n    throw new IllegalStateException(dto + \" must be annotated with @MultipartForm\");\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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)"],"tags":["rest-client","multipart","annotation-missing","response-processing"],"backgroundTag":"missing-multipart-form-annotation","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"}