quarkusio/quarkus · error · IllegalArgumentException

${methodName} is not a getter

Error message

${methodName} is not a getter

What it means

JavaBeanUtil.getPropertyNameFromGetter derives a property name from a getter method name (getXxx/isXxx). If the method name starts with neither 'get' nor 'is', it cannot be a getter and an IllegalArgumentException is thrown.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/bean/JavaBeanUtil.java:70

                return new String(chars);
            }
        } else {
            return name;
        }
    }

    /**
     * Returns the corresponding property name for a getter method name
     *
     * @throws IllegalArgumentException if the method name does not follow the getter name convention
     */
    public static String getPropertyNameFromGetter(String methodName) {
        if (methodName.startsWith(GET)) {
            return decapitalize(methodName.substring(GET.length()));
        } else if (methodName.startsWith(IS)) {
            return decapitalize(methodName.substring(IS.length()));
        } else {
            throw new IllegalArgumentException(methodName + " is not a getter");
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Filter candidate methods with name.startsWith("get") || name.startsWith("is") before calling this utility.
  2. Rename the method to follow JavaBean conventions (getXxx/isXxx) if it is intended to be a property accessor.
  3. Handle the IllegalArgumentException if non-getter methods are expected in your scan.

Example fix

// before
String prop = JavaBeanUtil.getPropertyNameFromGetter(method.getName());
// after
String name = method.getName();
if (name.startsWith("get") || name.startsWith("is")) {
    String prop = JavaBeanUtil.getPropertyNameFromGetter(name);
}
Defensive patterns

Strategy: type-guard

Validate before calling

String n = method.getName();
if (!(n.startsWith("get") || n.startsWith("is"))) {
    throw new IllegalArgumentException("Not a JavaBean getter: " + n);
}

Type guard

static boolean isGetterName(String methodName) {
    return methodName.startsWith("get") || methodName.startsWith("is");
}

Try / catch

try {
    prop = JavaBeanUtil.getPropertyNameFromGetter(name);
} catch (IllegalArgumentException e) {
    prop = null; // skip non-getter methods
}

Prevention

When it happens

Trigger: Calling getPropertyNameFromGetter with a method name like 'size()', 'toString()', or any non-getter name; reflection-based bean scanning passing a method that is not a standard JavaBean accessor.

Common situations: Bean introspection utilities encountering irregular accessors; passing field-like method names without the get/is prefix; custom config or bean mapping code feeding arbitrary methods in.

Related errors


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