quarkusio/quarkus · error · IllegalArgumentException
Attribute ${attr} of @Query is currently not supported. Offe
Error message
Attribute ${attr} of @Query is currently not supported. Offending method is ${method} of Repository ${repository} What it means
The extension only supports the 'value' (and 'countName'/'countQuery'-style value field) attributes of Spring Data's @Query annotation at build time. Any other attribute set on @Query (e.g. nativeQuery, name, countName in unsupported form) is rejected with this IllegalArgumentException during augmentation because generating the query method cannot honor it.
Source
Thrown at extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/CustomQueryMethodsAdder.java:425
customClassCreatedCallback.accept(implName.toString());
}
}
private Set<String> extractNamedParameters(String queryString) {
Set<String> namedParameters = new LinkedHashSet<>();
final Matcher matcher = NAMED_PARAMETER.matcher(queryString);
while (matcher.find()) {
namedParameters.add(matcher.group(1));
}
return namedParameters;
}
// we currently only support the 'value' attribute of @Query
private void verifyQueryAnnotation(AnnotationInstance queryInstance, String methodName, String repositoryName) {
List<AnnotationValue> values = queryInstance.values();
for (AnnotationValue value : values) {
if (!QUERY_VALUE_FIELD.equals(value.name()) && !QUERY_COUNT_FIELD.equals(value.name())) {
throw new IllegalArgumentException("Attribute " + value.name() + " of @Query is currently not supported. " +
"Offending method is " + methodName + " of Repository " + repositoryName);
}
}
if (queryInstance.value(QUERY_VALUE_FIELD) == null) {
throw new IllegalArgumentException("'value' attribute must be specified on @Query annotation of method. " +
"Offending method is " + methodName + " of Repository " + repositoryName);
}
}
private Expr generateParamsArray(List<Integer> queryParameterIndexes, BlockCreator bc, ParamVar[] params) {
LocalVar paramsArray = bc.localVar("paramsArray", bc.newEmptyArray(Object.class, queryParameterIndexes.size()));
for (int i = 0; i < queryParameterIndexes.size(); i++) {
bc.set(paramsArray.elem(i), params[queryParameterIndexes.get(i)]);
}
return paramsArray;
}
private Expr generateParametersObject(Map<String, Integer> namedParameterToIndex, BlockCreator bc, ParamVar[] params) {View on GitHub (pinned to e1c734241f)
Solutions
- Remove unsupported attributes from @Query, keeping only value
- For native SQL, replace the native query with an equivalent JPQL query
- Perform the native query outside the repository via EntityManager in a custom repository fragment
- Check the extension version/docs for the currently supported @Query attribute set
Example fix
// before
@Query(value = "SELECT * FROM users WHERE age > :age", nativeQuery = true)
List<User> findOlderThan(int age);
// after
@Query("SELECT u FROM User u WHERE u.age > :age")
List<User> findOlderThan(int age); Defensive patterns
Strategy: validation
Validate before calling
// keep only 'value' (and supported count attribute) on @Query
Set<String> allowed = Set.of("value", "countQuery"); Prevention
- Never use nativeQuery=true with the Quarkus Spring Data extension
- Translate native SQL to JPQL
- Check the extension docs for supported @Query attributes before migrating
When it happens
Trigger: Using @Query with an attribute other than 'value' (the QUERY_VALUE_FIELD) or the supported count field, e.g. @Query(value = "...", nativeQuery = true), verified in CustomQueryMethodsAdder.verifyQueryAnnotation.
Common situations: Migrating Spring Data repositories that use nativeQuery = true; copying @Query definitions with named-query attributes (name/countName) from Spring projects.
Related errors
- 'value' attribute must be specified on @Query annotation of
- Method ${repositoryMethodDescription} cannot be parsed. Did
- Return type of method ${methodName} of Repository ${reposito
- ${t.name()} is not in the Quarkus Jandex index and cannot be
- spEL expressions are not currently supported. Offending meth
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/f336a0221b14baf3.
Report an issue: GitHub.