quarkusio/quarkus · error · GradleException
Failed to build AOT enhanced container image:
Error message
Failed to build AOT enhanced container image:
What it means
BuildAotEnhancedImageWorker runs the Quarkus bootstrap in a Gradle worker to build an AOT-enhanced container image (used for AOT-optimized JVM container builds). When the bootstrap throws BootstrapException, the worker rethrows it as a GradleException, including e.getMessage(). It means the Quarkus application AOT container-image build step failed during bootstrap.
Source
Thrown at devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/worker/BuildAotEnhancedImageWorker.java:45
try (CuratedApplication curatedApplication = createAppCreationContext()) {
Map<String, Object> context = Map.of(
"original-container-image", originalContainerImage,
"container-working-directory", containerWorkingDirectory,
"aot-file", aotFile);
AugmentAction action = curatedApplication.createAugmentor(
BuildAotEnhancedCustomizerProducer.class.getName(),
context);
action.performCustomBuild(
BuildEnhancedAotContainerImageCommandHandler.class.getName(),
null,
BuildAotOptimizedContainerImageResultBuildItem.class.getName());
LOGGER.info("AOT enhanced container image built successfully");
} catch (BootstrapException e) {
throw new GradleException("Failed to build AOT enhanced container image: " + e.getMessage(), e);
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Read the BootstrapException message appended to this error — it names the failing build step or config key.
- Validate quarkus.* config with ./gradlew quarkusShowEffectiveConfig or check for typos in build configuration.
- Run the standard quarkusBuild first to confirm the base application build works before the AOT image path.
- Update Quarkus Gradle plugin and extensions to matching versions (mixed versions often break bootstrap).
Defensive patterns
Strategy: try-catch
Validate before calling
./gradlew quarkusShowEffectiveConfig # validate quarkus.* config before AOT build ./gradlew quarkusBuild # confirm the base build succeeds first
Try / catch
try {
./gradlew buildAotEnhancedImage
} catch (GradleException e) {
if (e.getMessage().startsWith("Failed to build AOT enhanced container image:")) {
// act on the BootstrapException message embedded in the error text
}
} Prevention
- Run the standard quarkusBuild first to validate config and the application model
- Keep the Quarkus Gradle plugin, core, and all extensions on the same release version
- Validate AOT/image-related quarkus.* properties before building
- Pin Quarkus versions via the BOM to avoid mixed-version drift
When it happens
Trigger: Running an AOT container image build task (e.g. via quarkusBuild with AOT-enabled image building) where QuarkusBootstrap.builder(...).buildInitialRuntimeApplication() or running the build step chain throws BootstrapException — missing application model, bad configuration, or a failing build step.
Common situations: Invalid or missing quarkus.* configuration for AOT image building; classpath/application model resolution failure; unsupported plugin/extension combination for the AOT path; missing GraalVM/native-tooling-related config when invoking from Gradle worker.
Related errors
- Task: %s requires extensions: %s. To add the extensions to t
- Task: %s requires one of the extensions: %s. To add the exte
- Failed to run application
- Failed to build Quarkus application for
- Failed to generate sources in the QuarkusGenerateCode task f
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/d0595a3644f092b5.
Report an issue: GitHub.