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

  1. Apply IsTrue/IsFalse only to boolean fields: e.g. findByActiveIsTrue() where active is boolean
  2. Use an equality method for non-boolean fields: findByNameEquals(...)
  3. 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

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


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/2ac7240a67d2a294. Report an issue: GitHub.