{"record":{"id":"7a0064f2706ced63","repo":"quarkusio/quarkus","slug":"value-attribute-must-be-specified-on-query-anno","errorCode":null,"errorMessage":"'value' attribute must be specified on @Query annotation of method. Offending method is ${method} of Repository ${repository}","messagePattern":"'value' attribute must be specified on @Query annotation of method\\. Offending method is (.+?) of Repository (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/CustomQueryMethodsAdder.java","lineNumber":430,"sourceCode":"        Set<String> namedParameters = new LinkedHashSet<>();\n        final Matcher matcher = NAMED_PARAMETER.matcher(queryString);\n        while (matcher.find()) {\n            namedParameters.add(matcher.group(1));\n        }\n        return namedParameters;\n    }\n\n    // we currently only support the 'value' attribute of @Query\n    private void verifyQueryAnnotation(AnnotationInstance queryInstance, String methodName, String repositoryName) {\n        List<AnnotationValue> values = queryInstance.values();\n        for (AnnotationValue value : values) {\n            if (!QUERY_VALUE_FIELD.equals(value.name()) && !QUERY_COUNT_FIELD.equals(value.name())) {\n                throw new IllegalArgumentException(\"Attribute \" + value.name() + \" of @Query is currently not supported. \" +\n                        \"Offending method is \" + methodName + \" of Repository \" + repositoryName);\n            }\n        }\n        if (queryInstance.value(QUERY_VALUE_FIELD) == null) {\n            throw new IllegalArgumentException(\"'value' attribute must be specified on @Query annotation of method. \" +\n                    \"Offending method is \" + methodName + \" of Repository \" + repositoryName);\n        }\n    }\n\n    private Expr generateParamsArray(List<Integer> queryParameterIndexes, BlockCreator bc, ParamVar[] params) {\n        LocalVar paramsArray = bc.localVar(\"paramsArray\", bc.newEmptyArray(Object.class, queryParameterIndexes.size()));\n        for (int i = 0; i < queryParameterIndexes.size(); i++) {\n            bc.set(paramsArray.elem(i), params[queryParameterIndexes.get(i)]);\n        }\n        return paramsArray;\n    }\n\n    private Expr generateParametersObject(Map<String, Integer> namedParameterToIndex, BlockCreator bc, ParamVar[] params) {\n        LocalVar parameters = bc.localVar(\"parameters\", bc.new_(ClassDesc.of(Parameters.class.getName())));\n        for (Map.Entry<String, Integer> entry : namedParameterToIndex.entrySet().stream()\n                .sorted(Map.Entry.comparingByKey()).toList()) {\n            bc.invokeVirtual(\n                    MethodDesc.of(Parameters.class, \"and\", Parameters.class,","sourceCodeStart":412,"sourceCodeEnd":448,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/CustomQueryMethodsAdder.java#L412-L448","documentation":"@Query requires its 'value' attribute to be present so the extension knows what query to generate. When the annotation instance has no 'value' set (only other attributes or empty), CustomQueryMethodsAdder.verifyQueryAnnotation throws this error at build time because there is no query string to compile into the method body.","triggerScenarios":"Declaring @Query on a repository method without supplying the query string, e.g. @Query(\"\") handled as missing or @Query(countName = \"...\") only, detected in verifyQueryAnnotation when queryInstance.value(QUERY_VALUE_FIELD) is null.","commonSituations":"Leaving the query empty as a TODO; using only named-query attributes like name/countName copied from Spring; IDE template generating @Query() without value.","solutions":["Provide the JPQL string in the 'value' attribute of @Query","If the method should be derived from its name, remove @Query entirely and let method-name parsing generate the query","Remove the method if it is unused/accidental","Move the query to a custom repository fragment implementation if it needs dynamic construction"],"exampleFix":"// before\n@Query\nList<User> findActive();\n\n// after\n@Query(\"SELECT u FROM User u WHERE u.active = true\")\nList<User> findActive();","handlingStrategy":"validation","validationCode":"boolean ok = q != null && !q.value().isBlank();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never commit @Query without a value","Remove placeholder empty @Query annotations before merging","Let derived method names generate queries instead of empty @Query"],"tags":["quarkus","spring-data-jpa","build-time","query-annotation","missing-attribute"],"backgroundTag":"missing-required-annotation-attribute","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"}