quarkusio/quarkus · error · GradleException

Failed to call method

Error message

Failed to call method 

What it means

ConfigurationUtils.callGetter invokes the located getter reflectively on the Quarkus Gradle extension configuration. If invocation fails with IllegalAccessException or InvocationTargetException, it throws a GradleException naming the method and class. The underlying cause (the getter itself threw, or access was denied) is attached to the GradleException.

Source

Thrown at devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/extension/ConfigurationUtils.java:28

// This is necessary because in included builds the returned `Project` instance and
// `QuarkusExtensionConfiguration` extension is provided by a different class loader
// which prevents us from creating some interface or casting to it directly.
public class ConfigurationUtils {
    private static Object callGetter(@NotNull Object extensionConfiguration, String getterName) {
        final Method getterMethod;

        try {
            getterMethod = extensionConfiguration.getClass().getMethod(getterName);
        } catch (NoSuchMethodException e) {
            throw new GradleException(
                    "Didn't find method " + getterName + " on class " + extensionConfiguration.getClass().getName(), e);
        }

        try {
            return getterMethod.invoke(extensionConfiguration);
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw new GradleException(
                    "Failed to call method " + getterName + " on class " + extensionConfiguration.getClass().getName(), e);
        }
    }

    @SuppressWarnings("unchecked")
    public static Property<String> getDeploymentModule(@NotNull Object extensionConfiguration) {
        return (Property<String>) callGetter(extensionConfiguration, "getDeploymentModule");
    }

    @SuppressWarnings("unchecked")
    public static ListProperty<String> getConditionalDependencies(@NotNull Object extensionConfiguration) {
        return (ListProperty<String>) callGetter(extensionConfiguration, "getConditionalDependencies");
    }

    @SuppressWarnings("unchecked")
    public static ListProperty<String> getConditionalDevDependencies(@NotNull Object extensionConfiguration) {
        return (ListProperty<String>) callGetter(extensionConfiguration, "getConditionalDevDependencies");
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the caused-by exception in the GradleException stack trace to see what the getter actually threw
  2. Fix the extension configuration value that the getter was trying to return (e.g. malformed conditional dependency declaration)
  3. Ensure the same Quarkus Gradle plugin version is used consistently across all projects
  4. Align Gradle and Quarkus plugin versions to a supported combination

Example fix

// before — conditional dependency with an invalid coordinate in build.gradle
quarkus { conditionalDependencies { enabler("io.quarkus:does-not-exist") } }
// after
quarkus { conditionalDependencies { enabler("io.quarkus:quarkus-rest-client") } }
Defensive patterns

Strategy: try-catch

Validate before calling

// smoke-test the getters before evaluation completes
def ext = project.extensions.findByName('quarkus')
try {
    ext?.deploymentModule
} catch (Throwable t) {
    logger.warn("Quarkus extension getter failed early: {}", t.message)
}

Try / catch

try {
    project.evaluate()
} catch (GradleException e) {
    if (e.message?.startsWith('Failed to call method ')) {
        logger.error("Getter threw: inspect caused-by for the real failure: {}", e.cause?.cause ?: e.cause ?: e)
    }
    throw e
}

Prevention

When it happens

Trigger: getDeploymentModule, getConditionalDependencies, getConditionalDevDependencies, or getDependencyConditions successfully find the getter method, but invoking it on the extension configuration throws at runtime.

Common situations: Getter lazily computing a Property value that itself fails (e.g. invalid configuration values); Gradle restricting reflective access to decorated/internal classes; classpath mixing Quarkus plugin versions so the extension object's state is inconsistent.

Related errors


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