quarkusio/quarkus · error · GradleException

Failed to run application

Error message

Failed to run application

What it means

QuarkusRun.runQuarkus bootstraps the application via QuarkusBootstrap. If bootstrap fails with a BootstrapException, it wraps it as GradleException("Failed to run application"). Note that the 'too many run targets' case is only logged, not thrown; this error means application bootstrap itself failed.

Source

Thrown at devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusRun.java:206

                                } finally {
                                    Runtime.getRuntime().removeShutdownHook(hook);
                                }
                            })
                            .run();
                }
            },
                    RunCommandActionResultBuildItem.class.getName(), DevServicesLauncherConfigResultBuildItem.class.getName());
            if (target != null && !exists.get()) {
                getLogger().error("quarkus.run.target " + target + " is not found");
                return;
            }
            if (tooMany.get() != null) {
                getLogger().error(
                        "Too many installed extensions support quarkus:run.  Use -Dquarkus.run.target=<target> to choose");
                getLogger().error("Extensions: " + tooMany.get());
            }
        } catch (BootstrapException e) {
            throw new GradleException("Failed to run application", e);
        }
    }

}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Run with --stacktrace/--info to see the wrapped BootstrapException cause and fix the root problem.
  2. Verify application config (application.properties) and quarkus.package.main-class are valid.
  3. Clean the build (./gradlew clean quarkusRun) to remove stale augmented outputs, then retry.

Example fix

// before (application.properties)
quarkus.package.main-class=com.example.Mis spelled.Main

// after
quarkus.package.main-class=com.example.Main
Defensive patterns

Strategy: try-catch

Validate before calling

// validate main class and basic config before running
def mainClass = providers.gradleProperty('quarkus.package.main-class').orElse(providers.property('quarkus.package.run-module')).getOrElse('')
assert mainClass.isEmpty() || classes.findByFqn(mainClass as String) != null : 'quarkus.package.main-class not found on classpath'

Try / catch

try { ./gradlew quarkusRun } catch (GradleException e) { if (e.message == 'Failed to run application' && e.cause instanceof BootstrapException) { /* inspect e.cause.cause for the real bootstrap failure */ } }

Prevention

When it happens

Trigger: Running ./gradlew quarkusRun when the application cannot be bootstrapped: missing/invalid main class, classpath augmentation failure, bad configuration values, or deployment-time errors during augmentation.

Common situations: quarkus.package.main-class pointing to a nonexistent class; configuration property errors surfaced at bootstrap; corrupted build/classes outputs; incompatible extension versions on the classpath.

Related errors


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