{"record":{"id":"9dfeb73a64a28977","repo":"quarkusio/quarkus","slug":"primitive-types-are-not-supported-for-multipart-re","errorCode":null,"errorMessage":"Primitive types are not supported for multipart response mapping. Please use a wrapper class instead","messagePattern":"Primitive types are not supported for multipart response mapping\\. Please use a wrapper class instead","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-client-jaxrs/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java","lineNumber":701,"sourceCode":"    }\n\n    private void createFieldFillerConstructor(AnnotationInstance partType, Type type, String partName,\n            String fillerClassName, ClassCreator c) {\n        MethodCreator ctor = c.getMethodCreator(MethodDescriptor.ofConstructor(fillerClassName));\n\n        ResultHandle genericType;\n        if (type.kind() == PARAMETERIZED_TYPE) {\n            genericType = createGenericTypeFromParameterizedType(ctor, type.asParameterizedType());\n        } else if (type.kind() == CLASS) {\n            genericType = ctor.newInstance(\n                    MethodDescriptor.ofConstructor(GenericType.class, java.lang.reflect.Type.class),\n                    ctor.loadClassFromTCCL(type.asClassType().name().toString()));\n        } else if (type.kind() == ARRAY) {\n            genericType = ctor.newInstance(\n                    MethodDescriptor.ofConstructor(GenericType.class, java.lang.reflect.Type.class),\n                    ctor.loadClassFromTCCL(type.asArrayType().name().toString()));\n        } else if (type.kind() == PRIMITIVE) {\n            throw new IllegalArgumentException(\"Primitive types are not supported for multipart response mapping. \" +\n                    \"Please use a wrapper class instead\");\n        } else {\n            throw new IllegalArgumentException(\"Unsupported field type for multipart response mapping: \" +\n                    type + \". Only classes, arrays and parameterized types are supported\");\n        }\n\n        ctor.invokeSpecialMethod(\n                MethodDescriptor.ofConstructor(FieldFiller.class, GenericType.class, String.class, String.class),\n                ctor.getThis(), genericType, ctor.load(partName), ctor.load(partType.value().asString()));\n        ctor.returnValue(null);\n    }\n\n    private AnnotationInstance partTypeFromGetterOrSetter(MethodInfo setter) {\n        AnnotationInstance partTypeAnno = setter.annotation(PART_TYPE_NAME);\n        if (partTypeAnno != null) {\n            return partTypeAnno;\n        }\n","sourceCodeStart":683,"sourceCodeEnd":719,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-client-jaxrs/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java#L683-L719","documentation":"Multipart response field fillers are generated via bytecode that wraps the declared type in a GenericType. Primitive kinds (int, boolean, etc.) cannot be loaded as a class via loadClassFromTCCL in this path, so the generator rejects them and asks for the wrapper class (Integer, Boolean, ...).","triggerScenarios":"Declaring a multipart REST client response field of primitive type (e.g. int count, boolean active) in the class mapped from a multipart response, triggering the FieldFiller generation at build time.","commonSituations":"Writing DTOs with primitive fields by habit; JSON examples implying primitives; migrating a non-multipart DTO to multipart use without adjusting field types.","solutions":["Change the field type to its wrapper class (int -> Integer, boolean -> Boolean, long -> Long, etc.)","Rebuild; if the field is used with @PartType, keep the annotation on the wrapper field"],"exampleFix":"// before\nclass MultipartBody {\n    @PartType(\"text/plain\")\n    public int count;\n}\n// after\nclass MultipartBody {\n    @PartType(\"text/plain\")\n    public Integer count;\n}","handlingStrategy":"validation","validationCode":"for (var f : MultipartBody.class.getDeclaredFields()) { if (f.getType().isPrimitive()) throw new IllegalStateException(\"Use wrapper type for multipart field: \" + f.getName()); }","typeGuard":"boolean isWrapperUsable(Class<?> c) { return !c.isPrimitive() && (c == Integer.class || c == Long.class || c == Boolean.class || c == Double.class || c == Float.class || c == Short.class || c == Byte.class || c == Character.class || !c.getSimpleName().isEmpty()); }","tryCatchPattern":"try { client.upload(body); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Primitive types\")) { log.error(\"Change primitive field to wrapper class\"); } throw e; }","preventionTips":["Always use Integer/Long/Boolean etc. in multipart DTO fields","Keep DTO fields object-typed for framework-generated mapping","Run the Quarkus build early to catch build-time failures","Prefer boxed types in client-facing DTOs"],"tags":["quarkus","rest-client","multipart","primitive-type","build-time"],"backgroundTag":"primitive-type-not-supported","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"}