{"record":{"id":"846815ae2a126c54","repo":"quarkusio/quarkus","slug":"cannot-get-queryreader-for-type","errorCode":null,"errorMessage":"Cannot get QueryReader for: \" + type","messagePattern":"Cannot get QueryReader for: \" \\+ type","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/funqy/funqy-server-common/runtime/src/main/java/io/quarkus/funqy/runtime/query/QueryObjectMapper.java","lineNumber":85,"sourceCode":"            };\n        }\n        return null;\n    }\n\n    Map<Class, QueryObjectReader> readers = new HashMap<>();\n\n    public <T> QueryReader<T> readerFor(Class<T> clz) {\n        return readerFor(clz, null);\n    }\n\n    public QueryReader readerFor(Type type) {\n        Class<?> clazz = null;\n        if (type instanceof Class) {\n            clazz = (Class<?>) type;\n        } else if (type instanceof ParameterizedType) {\n            clazz = (Class<?>) ((ParameterizedType) type).getRawType();\n        } else {\n            throw new RuntimeException(\"Cannot get QueryReader for: \" + type);\n        }\n        return readerFor(clazz, type);\n    }\n\n    public <T> QueryReader<T> readerFor(Class<T> clz, Type genericType) {\n        if (clz.equals(Map.class)) {\n            return (QueryReader<T>) new QueryMapReader(genericType, this);\n        }\n        QueryObjectReader reader = readers.get(clz);\n        if (reader != null)\n            return (QueryReader<T>) reader;\n        reader = new QueryObjectReader(clz, this);\n        readers.put(clz, reader);\n        return (QueryReader<T>) reader;\n    }\n\n    QueryPropertySetter setterFor(Class clz, Type genericType) {\n        if (clz.equals(List.class)) {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/funqy/funqy-server-common/runtime/src/main/java/io/quarkus/funqy/runtime/query/QueryObjectMapper.java#L67-L103","documentation":"QueryObjectMapper.readerFor(Type) can only produce a QueryReader for plain Class types or parameterized types. Any other Type implementation (GenericArrayType, WildcardType, TypeVariable) is rejected with 'Cannot get QueryReader for: <type>'.","triggerScenarios":"A @Funq function parameter whose resolved generic type is a wildcard (List<?>) or type variable (T) reaching query binding resolution.","commonSituations":"Using wildcard generics in function signatures; generic wrapper classes passed as parameters; frameworks resolving types to TypeVariable due to erased generics.","solutions":["Replace wildcard types with concrete types in the function signature (List<String> instead of List<?>)","Use a concrete class parameter instead of a generic type variable","Unwrap parameterized types manually before calling readerFor if using the mapper API directly"],"exampleFix":"// before\n@Funq public void f(List<?> items) { ... }\n// after\n@Funq public void f(List<String> items) { ... }","handlingStrategy":"type-guard","validationCode":"// Reject unsupported Type kinds before calling readerFor\nstatic void assertReaderCapable(Type t) {\n    if (!(t instanceof Class || t instanceof ParameterizedType))\n        throw new IllegalArgumentException(\"Unsupported type: \" + t);\n}","typeGuard":"static boolean isReaderCapable(Type t) {\n    return t instanceof Class || t instanceof ParameterizedType;\n}","tryCatchPattern":"try {\n    QueryReader<?> r = mapper.readerFor(type);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Cannot get QueryReader for:\"))\n        log.error(\"Replace wildcard/type-variable generics with concrete types\");\n    throw e;\n}","preventionTips":["Use concrete parameterized types in @Funq signatures","Avoid List<?>, Map<String,?> and raw type variables","Add reflection tests asserting concrete generic types on function parameters"],"tags":["quarkus","funqy","generics","query-binding"],"backgroundTag":"unsupported-generic-type","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"}