gradle/gradle · error · NoSuchPropertyException

Could not find getter method for property '%s' on class %s.

Error message

Could not find getter method for property '%s' on class %s.

What it means

Error "Could not find getter method for property '%s' on class %s." thrown in gradle/gradle.

Source

Thrown at platforms/core-configuration/model-reflect/src/main/java/org/gradle/internal/reflect/JavaPropertyReflectionUtil.java:54

public class JavaPropertyReflectionUtil {

    private static final ClassValue<Set<String>> PROPERTY_CACHE = new ClassValue<Set<String>>() {
        @Override
        protected Set<String> computeValue(Class<?> type) {
            return ClassInspector.inspect(type).getPropertyNames();
        }
    };

    /**
     * Locates the property with the given name as a readable property. Searches only public properties.
     *
     * @throws NoSuchPropertyException when the given property does not exist.
     */
    public static <T, F> PropertyAccessor<T, F> readableProperty(Class<T> target, Class<F> returnType, String property) throws NoSuchPropertyException {
        final Method getterMethod = findGetterMethod(target, property);
        if (getterMethod == null) {
            throw new NoSuchPropertyException(String.format("Could not find getter method for property '%s' on class %s.", property, target.getSimpleName()));
        }
        return new GetterMethodBackedPropertyAccessor<T, F>(property, returnType, getterMethod);
    }

    /**
     * Locates the property with the given name as a readable property. Searches only public properties.
     *
     * @throws NoSuchPropertyException when the given property does not exist.
     */
    public static <T, F> PropertyAccessor<T, F> readableProperty(T target, Class<F> returnType, String property) throws NoSuchPropertyException {
        @SuppressWarnings("unchecked")
        Class<T> targetClass = (Class<T>) target.getClass();
        return readableProperty(targetClass, returnType, property);
    }

    @Nullable
    public static Method findGetterMethod(Class<?> target, String property) {
        Method[] methods = target.getMethods();

View on GitHub (pinned to 534f27719b)

Solutions

  1. No getter method exists for the property on the class. Add a getter (getX/isX) for the property, or correct the property name.

When it happens

Trigger: Thrown at platforms/core-configuration/model-reflect/src/main/java/org/gradle/internal/reflect/JavaPropertyReflectionUtil.java:54 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gradle/gradle@534f27719b (2026-08-22). Data as JSON: /api/errors/80b55368e521e31b. Report an issue: GitHub.