quarkusio/quarkus · error · GradleException

Failed to run

Error message

Failed to run

What it means

The entire body of QuarkusDev.startDev — preparing arguments, writing config, and launching the dev-mode forked JVM via ExecOperations — is wrapped in a try/catch that rethrows any Exception as a GradleException('Failed to run', e). It is a generic wrapper; the real cause is the chained exception, which must be read from the full stack trace.

Solutions

  1. Read the 'Caused by' chain in the stack trace to find the real failure and fix that first
  2. Run ./gradlew quarkusDev --stacktrace --info for the full cause and context
  3. Verify JAVA_HOME/java toolchain availability and that no other process holds the dev-mode port
  4. Delete build output (./gradlew clean) to clear stale generated files, then retry

Example fix

// diagnose, don't patch:
./gradlew quarkusDev --stacktrace --info
// then fix the underlying 'Caused by' (e.g. free port 8080:
// lsof -i :8080 && kill <pid>)
Defensive patterns

Strategy: try-catch

Try / catch

// always inspect the cause chain, not the wrapper message
try {
    ./gradlew quarkusDev --stacktrace --info
} catch (...) { /* parse 'Caused by:' entries and fix the root cause */ }

Prevention

When it happens

Trigger: Any exception while starting dev mode: failure to resolve/fork the dev-mode process, malformed configuration written for the application, IO errors on generated files, or a thrown error during analytics prompt handling.

Common situations: Invalid quarkus.* properties that dev mode cannot serialize; port conflicts or missing java toolchain when forking; corrupted application model; failure downloading the dev-mode artifacts listed just above this wrapper in the log.

Related errors


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

Appendix: source

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

            if (outputFile == null) {
                getExecOperations().exec(action -> {
                    action.commandLine(runner.getArguments()).workingDir(getWorkingDirectory().get());
                    action.environment(getEnvVars());
                    action.setStandardInput(System.in)
                            .setErrorOutput(System.out)
                            .setStandardOutput(System.out);
                });
            } else {
                try (BufferedWriter is = Files.newBufferedWriter(Paths.get(outputFile))) {
                    for (String i : runner.getArguments()) {
                        is.write(i);
                        is.newLine();
                    }
                }
            }

        } catch (Exception e) {
            throw new GradleException("Failed to run", e);
        } finally {
            analyticsService.close();
        }
    }

    private boolean sourcesExist() {
        final Set<FileSystemLocation> srcDirLocations = mainSourceSet.getAllJava().getSourceDirectories().getElements().get();
        for (FileSystemLocation srcDirLocation : srcDirLocations) {
            final File srcDir = srcDirLocation.getAsFile();
            if (srcDir.exists() && srcDir.isDirectory()) {
                final File[] files = srcDir.listFiles();
                if (files != null && files.length > 0) {
                    return true;
                }
            }
        }
        return false;
    }

View on GitHub (pinned to e1c734241f)