quarkusio/quarkus · error · RuntimeException

errorMessage

Error message

errorMessage

What it means

JavaCompilationProvider.compile() collects diagnostics from the JavaCompiler compilation task. If the task did not succeed, it extracts a formatted compilation error message (file, line, message per diagnostic) and throws a RuntimeException whose message is that compilation error report. This is the standard 'your code did not compile' failure surfaced during live reload or continuous testing.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/dev/JavaCompilationProvider.java:106

        }

        final DiagnosticCollector<JavaFileObject> diagnosticsCollector = new DiagnosticCollector<>();

        final Iterable<? extends JavaFileObject> sources = this.fileManager.getJavaSources(filesToCompile);
        final JavaCompiler.CompilationTask task = this.compiler.getTask(null, this.fileManager,
                diagnosticsCollector, this.compilerFlags, null, sources);

        final boolean compilationTaskSucceed = task.call();

        if (LOG.isEnabled(Logger.Level.ERROR) || LOG.isEnabled(Logger.Level.WARN)) {
            collectDiagnostics(diagnosticsCollector, (level, diagnostic) -> LOG.logf(level, "%s, line %d in %s",
                    diagnostic.getMessage(null), diagnostic.getLineNumber(),
                    diagnostic.getSource() == null ? "[unknown source]" : diagnostic.getSource().getName()));
        }

        if (!compilationTaskSucceed) {
            final String errorMessage = extractCompilationErrorMessage(diagnosticsCollector);
            throw new RuntimeException(errorMessage);
        }
    }

    @Override
    public void close() throws IOException {
        if (this.fileManager != null) {
            this.fileManager.close();
            this.fileManager = null;
        }
    }

    private void collectDiagnostics(final DiagnosticCollector<JavaFileObject> diagnosticsCollector,
            final BiConsumer<Logger.Level, Diagnostic<? extends JavaFileObject>> callback) {
        for (Diagnostic<? extends JavaFileObject> diagnostic : diagnosticsCollector.getDiagnostics()) {
            Logger.Level level = diagnostic.getKind() == Diagnostic.Kind.ERROR ? Logger.Level.ERROR : Logger.Level.WARN;
            if (level.equals(Logger.Level.WARN) && IGNORE_NAMESPACES.stream()
                    .anyMatch(diagnostic.getMessage(null)::contains)) {
                continue;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the error message: it names the source file, line number, and javac diagnostic.
  2. Fix the compilation error in the indicated file and re-save to trigger recompilation.
  3. If diagnostics mention missing symbols, run a full clean build of the module to refresh the classpath.

Example fix

// before (src/main/java/Foo.java, line 12)
String s = undeclaredVariable;

// after
String s = "declared value";
Defensive patterns

Strategy: try-catch

Try / catch

try {
    // save / reload
} catch (RuntimeException e) {
    // message is the javac diagnostic: parse file + line, fix source, re-save
}

Prevention

When it happens

Trigger: Any javac compilation failure in sources being hot-reloaded or compiled at runtime: syntax errors, missing imports, unresolved symbols in modified files.

Common situations: Editing source code with a mistake during live reload; incomplete refactoring saved mid-way; code that compiles in the IDE with different annotation processing but fails in Quarkus's compiler.

Related errors


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