{"record":{"id":"2ac7240a67d2a294","repo":"quarkusio/quarkus","slug":"operation-cannot-be-specified-for-field-fieldp-2ac724","errorCode":null,"errorMessage":"${operation} cannot be specified for field${fieldPath} because it is not a boolean type. Offending method is ${repositoryMethodDescription}.","messagePattern":"(.+?) cannot be specified for field(.+?) because it is not a boolean type\\. Offending method is (.+?)\\.","errorType":"exception","errorClass":"UnableToParseMethodException","httpStatus":null,"severity":"error","filePath":"extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/MethodNameParser.java","lineNumber":618,"sourceCode":"        boolean endsCorrectly = (index + operatorStr.length() == str.length())\n                || Character.isUpperCase(str.charAt(index + operatorStr.length()));\n\n        return startsCorrectly && endsCorrectly;\n\n    }\n\n    private void validateFieldWithOperation(String operation, FieldInfo fieldInfo, String fieldPath,\n            String repositoryMethodDescription) {\n        DotName fieldTypeDotName = fieldInfo.type().name();\n        if (STRING_LIKE_OPERATIONS.contains(operation) && !DotNames.STRING.equals(fieldTypeDotName)) {\n            throw new UnableToParseMethodException(\n                    operation + \" cannot be specified for field\" + fieldPath + \" because it is not a String type. \"\n                            + \"Offending method is \" + repositoryMethodDescription + \".\");\n        }\n\n        if (BOOLEAN_OPERATIONS.contains(operation) && !DotNames.BOOLEAN.equals(fieldTypeDotName)\n                && !DotNames.PRIMITIVE_BOOLEAN.equals(fieldTypeDotName)) {\n            throw new UnableToParseMethodException(\n                    operation + \" cannot be specified for field\" + fieldPath + \" because it is not a boolean type. \"\n                            + \"Offending method is \" + repositoryMethodDescription + \".\");\n        }\n    }\n\n    private QueryType getType(String methodName) {\n        if (methodName.startsWith(\"find\") || methodName.startsWith(\"query\") || methodName.startsWith(\"read\")\n                || methodName.startsWith(\"get\")) {\n            return QueryType.SELECT;\n        }\n        if (methodName.startsWith(\"count\")) {\n            return QueryType.COUNT;\n        }\n        if (methodName.startsWith(\"delete\") || methodName.startsWith(\"remove\")) {\n            return QueryType.DELETE;\n        }\n        if (methodName.startsWith(\"exists\")) {\n            return QueryType.EXISTS;","sourceCodeStart":600,"sourceCodeEnd":636,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/MethodNameParser.java#L600-L636","documentation":"A boolean-only derived query operation (e.g. IsTrue / IsFalse — BOOLEAN_OPERATIONS) was applied to a field that is neither Boolean nor primitive boolean. The parser throws UnableToParseMethodException at build time.","triggerScenarios":"Methods like findByNameIsTrue() or findByCreatedAtIsFalse() where the field is String/Integer/etc.; any operation in BOOLEAN_OPERATIONS whose FieldInfo type is not DotNames.BOOLEAN or PRIMITIVE_BOOLEAN.","commonSituations":"Autocompletion mishaps producing IsTrue/IsFalse on wrong fields; boolean flags renamed to enums/strings without updating derived queries; copy-paste of boolean query patterns.","solutions":["Apply IsTrue/IsFalse only to boolean fields: e.g. findByActiveIsTrue() where active is boolean","Use an equality method for non-boolean fields: findByNameEquals(...)","Change the entity field type to boolean if a true/false semantic is intended"],"exampleFix":"// before (name is String)\nList<User> findByNameIsTrue();\n// after\nList<User> findByName(String name);\n// or for a real flag:\nList<User> findByActiveIsTrue();","handlingStrategy":"validation","validationCode":"// Only append IsTrue/IsFalse to boolean fields:\n// if (!(field.getType() == boolean.class || field.getType() == Boolean.class)) skip;","typeGuard":null,"tryCatchPattern":"try {\n    parser.parse(methodName);\n} catch (UnableToParseMethodException e) {\n    // use equality for non-boolean fields or fix the field type\n    throw new IllegalStateException(\"Boolean op misuse: \" + e.getMessage());\n}","preventionTips":["Use IsTrue/IsFalse exclusively on boolean/Boolean fields","Audit derived queries after converting boolean flags to other types","Name boolean entity fields clearly (active, deleted) to avoid mixing them with other conditions"],"tags":["jpa","spring-data","derived-query","type-mismatch"],"backgroundTag":"derived-query-type-mismatch","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"}