{"record":{"id":"3aabbb562ecb4329","repo":"quarkusio/quarkus","slug":"failed-to-find-collection-supertype-of-field","errorCode":null,"errorMessage":"Failed to find Collection supertype of ${field}","messagePattern":"Failed to find Collection supertype of (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/Deployment.java","lineNumber":174,"sourceCode":"                field = fieldOwnerClass.getDeclaredField(fieldName);\n            } catch (NoSuchFieldException | SecurityException e) {\n                throw new RuntimeException(e);\n            }\n            Class<?> klass;\n            Type genericType;\n            if (single) {\n                klass = field.getType();\n                genericType = field.getGenericType();\n            } else {\n                genericType = field.getGenericType();\n                if (genericType instanceof ParameterizedType) {\n                    Type[] args = Types.findInterfaceParameterizedTypes(field.getType(), (ParameterizedType) genericType,\n                            Collection.class);\n                    if (args != null && args.length == 1) {\n                        genericType = args[0];\n                        klass = Types.getRawType(genericType);\n                    } else {\n                        throw new RuntimeException(\"Failed to find Collection supertype of \" + field);\n                    }\n                } else {\n                    throw new RuntimeException(\"Failed to find Collection supertype of \" + field);\n                }\n            }\n            Annotation[] annotations = field.getAnnotations();\n            for (ResourceParamConverterProvider converterProvider : providers) {\n                BeanInstance<ParamConverterProvider> instance = converterProvider.getFactory().createInstance();\n                ParamConverter<?> converter = instance.getInstance().getConverter(klass, genericType, annotations);\n                if (converter != null)\n                    return new RuntimeParameterConverter(converter);\n            }\n        }\n        return null;\n    }\n\n    public ThreadSetupAction getThreadSetupAction() {\n        return threadSetupAction;","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/Deployment.java#L156-L192","documentation":"Deployment.getRuntimeParamConverter builds runtime parameter converters for injectable fields. When the field's generic type is parameterized, it tries to resolve the Collection element type via Types.findInterfaceParameterizedTypes; if the type is not a Collection or the supertype lookup returns no single type argument, the deployment fails with this RuntimeException.","triggerScenarios":"A @ConfigMap/@Context-style injectable field whose generic type is parameterized but is not a Collection (or is a Collection whose interface parameterization cannot be resolved, e.g. raw Collection or exotic custom collection types).","commonSituations":"Injecting into a raw Collection field; using a custom collection class that does not directly expose Collection<E> parameterization; changing a field type from List<String> to Map or another non-collection generic type.","solutions":["Change the field type to a concrete parameterized collection such as List<MyType> or Set<MyType>.","Avoid raw Collection fields — always supply the element type parameter.","If a custom collection type is required, make it implement Collection<E> with a resolvable parameterization, or inject the element collection as List instead.","Use an @PathParam/@QueryParam array or provider-based conversion instead of relying on runtime converter resolution for exotic types."],"exampleFix":"// before\n@Inject CustomBag items; // non-Collection parameterized type\n// after\n@Inject List<MyItem> items;","handlingStrategy":"validation","validationCode":"if (genericType instanceof ParameterizedType pt) {\n    Type[] args = Types.findInterfaceParameterizedTypes(field.getType(), pt, Collection.class);\n    if (args == null || args.length != 1) {\n        throw new IllegalStateException(\"Field \" + field + \" must be a Collection<E> with a single type argument\");\n    }\n}","typeGuard":"static boolean isConcreteCollection(java.lang.reflect.Field f) {\n    return f.getGenericType() instanceof ParameterizedType pt\n        && Collection.class.isAssignableFrom(f.getType())\n        && pt.getActualTypeArguments().length == 1\n        && !(pt.getActualTypeArguments()[0] instanceof java.lang.reflect.TypeVariable);\n}","tryCatchPattern":"try {\n    converter = deployment.getRuntimeParamConverter(field, ...);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Failed to find Collection supertype\")) {\n        throw new IllegalArgumentException(\"Change \" + field + \" to a parameterized List/Set type\", e);\n    }\n    throw e;\n}","preventionTips":["Never declare injected fields as raw Collection/List types.","Prefer List<T>/Set<T> over custom collection classes for injectable fields.","Enable generics linting (rawtypes warnings) in the build.","Review field types after refactors that alter generic signatures."],"tags":["quarkus","resteasy-reactive","generics","deployment","paramconverter"],"backgroundTag":"generic-type-resolution-failed","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"}