quarkusio/quarkus · error · UnableToParseMethodException
${operation} cannot be specified for field${fieldPath} becau
Error message
${operation} cannot be specified for field${fieldPath} because it is not a boolean type. Offending method is ${repositoryMethodDescription}. What it means
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.
Source
Thrown at extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/MethodNameParser.java:618
boolean endsCorrectly = (index + operatorStr.length() == str.length())
|| Character.isUpperCase(str.charAt(index + operatorStr.length()));
return startsCorrectly && endsCorrectly;
}
private void validateFieldWithOperation(String operation, FieldInfo fieldInfo, String fieldPath,
String repositoryMethodDescription) {
DotName fieldTypeDotName = fieldInfo.type().name();
if (STRING_LIKE_OPERATIONS.contains(operation) && !DotNames.STRING.equals(fieldTypeDotName)) {
throw new UnableToParseMethodException(
operation + " cannot be specified for field" + fieldPath + " because it is not a String type. "
+ "Offending method is " + repositoryMethodDescription + ".");
}
if (BOOLEAN_OPERATIONS.contains(operation) && !DotNames.BOOLEAN.equals(fieldTypeDotName)
&& !DotNames.PRIMITIVE_BOOLEAN.equals(fieldTypeDotName)) {
throw new UnableToParseMethodException(
operation + " cannot be specified for field" + fieldPath + " because it is not a boolean type. "
+ "Offending method is " + repositoryMethodDescription + ".");
}
}
private QueryType getType(String methodName) {
if (methodName.startsWith("find") || methodName.startsWith("query") || methodName.startsWith("read")
|| methodName.startsWith("get")) {
return QueryType.SELECT;
}
if (methodName.startsWith("count")) {
return QueryType.COUNT;
}
if (methodName.startsWith("delete") || methodName.startsWith("remove")) {
return QueryType.DELETE;
}
if (methodName.startsWith("exists")) {
return QueryType.EXISTS;View on GitHub (pinned to e1c734241f)
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
Example fix
// before (name is String) List<User> findByNameIsTrue(); // after List<User> findByName(String name); // or for a real flag: List<User> findByActiveIsTrue();
Defensive patterns
Strategy: validation
Validate before calling
// Only append IsTrue/IsFalse to boolean fields: // if (!(field.getType() == boolean.class || field.getType() == Boolean.class)) skip;
Try / catch
try {
parser.parse(methodName);
} catch (UnableToParseMethodException e) {
// use equality for non-boolean fields or fix the field type
throw new IllegalStateException("Boolean op misuse: " + e.getMessage());
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Autocompletion mishaps producing IsTrue/IsFalse on wrong fields; boolean flags renamed to enums/strings without updating derived queries; copy-paste of boolean query patterns.
Related errors
- IgnoreCase cannot be specified for field${fieldInfo.name()}
- ${operation} cannot be specified for field${fieldPath} becau
- Distinct is not yet supported. Offending method is ${reposit
- A field must by supplied after 'OrderBy' . Offending method
- Field ${orderField} which was configured as the order field
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/2ac7240a67d2a294.
Report an issue: GitHub.