quarkusio/quarkus · error · MojoExecutionException
Quarkus native image agent filter generation phase has faile
Error message
Quarkus native image agent filter generation phase has failed
What it means
GenerateCodeTestsMojo.getDependencies bootstraps the application in TEST launch mode to collect the application model's dependencies for native agent filter generation. Any exception during bootstrap or model retrieval is wrapped in this MojoExecutionException. The underlying cause (dependency resolution, curation, config) is in the `Caused by` chain.
Source
Thrown at devtools/maven/src/main/java/io/quarkus/maven/GenerateCodeTestsMojo.java:112
.forEach(rules::add);
result.put("rules", rules);
final Json.JsonArrayBuilder regexRules = Json.array();
regexRules.add(Json.object().put("excludeClasses", ".*_Bean"));
result.put("regexRules", regexRules);
try (BufferedWriter writer = new BufferedWriter(new FileWriter(path.toFile(), StandardCharsets.UTF_8))) {
result.appendTo(writer);
} catch (IOException e) {
throw new MojoExecutionException("Unable to write quarkus native image agent caller filter to " + path, e);
}
}
private Collection<ResolvedDependency> getDependencies() throws MojoExecutionException {
try (CuratedApplication curatedApplication = bootstrapApplication(LaunchMode.TEST)) {
return curatedApplication.getApplicationModel().getDependencies();
} catch (Exception any) {
throw new MojoExecutionException("Quarkus native image agent filter generation phase has failed", any);
}
}
private Set<String> getCommonExcludePackageNames() {
Set<String> packageNames = new HashSet<>();
// Any calls that access or originate in these packages
// that require native configuration should be handled by Quarkus.
packageNames.add("io.netty");
packageNames.add("io.quarkus");
packageNames.add("io.smallrye");
packageNames.add("io.vertx");
packageNames.add("jakarta");
packageNames.add("org.jboss");
return packageNames;
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Run with -e and inspect the `Caused by` for the root bootstrap failure
- Fix dependency resolution issues (`mvn dependency:resolve -U`)
- Align Quarkus extension versions with the platform BOM
- Validate quarkus.* test configuration properties
Example fix
mvn quarkus:generate-code-tests -e # read the Caused-by chain
Defensive patterns
Strategy: try-catch
Validate before calling
mvn dependency:resolve -U && mvn test-compile # confirm test-scope deps resolve and compile first
Try / catch
try {
mvn quarkus:generate-code-tests
} catch (MojoExecutionException e) {
Throwable root = e; while (root.getCause() != null) root = root.getCause();
// fix dependency/config issue reported by root
} Prevention
- Keep test dependencies resolvable and version-aligned with the platform
- Run `mvn dependency:resolve -U` after repo or version changes
- Validate test-scope quarkus.* configuration
When it happens
Trigger: bootstrapApplication(LaunchMode.TEST) or getApplicationModel().getDependencies() throws — e.g. unresolvable test-scoped dependencies, application curation errors, or invalid Quarkus configuration in test scope.
Common situations: Missing or conflicting test dependencies; platform/version misalignment; corrupted local repo preventing dependency resolution; quarkus.* config errors that fail application curation during `mvn quarkus:generate-code-tests`.
Related errors
- Could not resolve POM for
- Failed to build enhanced artifact
- Failed to resolve application model <appArtifact> dependenci
- Failed to resolve application model <appArtifact> dependenci
- Failed to resolve application model <appArtifact> dependenci
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/44ed327227be2557.
Report an issue: GitHub.