quarkusio/quarkus · error · UnsupportedOperationException
Unable to save enhanced Dockerfile contents to disk
Error message
Unable to save enhanced Dockerfile contents to disk
What it means
The Podman AOT-optimized container image build generates an enhanced Dockerfile (Dockerfile.aot) into the build output directory. If writing that file fails with an IOException, PodmanProcessor throws UnsupportedOperationException wrapping it, because the AOT build cannot proceed without the persisted Dockerfile.
Source
Thrown at extensions/container-image/container-image-podman/deployment/src/main/java/io/quarkus/container/image/podman/deployment/PodmanProcessor.java:215
Path outputDirectory = outputTargetBuildItem.getOutputDirectory();
Path aotFile = requestBuildItem.getAotFile();
String aotEnhancedDockerfileContent = """
FROM %s
# Add the app.aot file to the working directory
COPY %s %s
# Set the JAVA_TOOL_OPTIONS environment variable
ENV JAVA_TOOL_OPTIONS="-XX:AOTCache=%s"
""".formatted(baseImage, outputDirectory.relativize(aotFile),
requestBuildItem.getContainerWorkingDirectory(), aotFile.getFileName());
Path aotEnhancedDockerfile = outputDirectory.resolve("Dockerfile.aot");
try {
Files.write(aotEnhancedDockerfile, aotEnhancedDockerfileContent.getBytes());
} catch (IOException e) {
throw new UnsupportedOperationException("Unable to save enhanced Dockerfile contents to disk", e);
}
String executableName = getExecutableName(podmanConfig, ContainerRuntime.PODMAN);
var dockerBuildArgs = getPodmanBuildArgs(enhancedImage, new DockerfilePaths() {
@Override
public Path dockerfilePath() {
return aotEnhancedDockerfile;
}
@Override
public Path dockerExecutionPath() {
return outputDirectory;
}
}, containerImageConfig,
podmanConfig, false);
LOG.infof("Executing the following command to build image: '%s %s'", executableName,
String.join(" ", dockerBuildArgs));View on GitHub (pinned to e1c734241f)
Solutions
- Read the 'Caused by' IOException to see the exact filesystem problem and fix it (permissions, space, path).
- Ensure the build output directory (target/) exists and is writable; run mvn clean to reset a corrupted output tree.
- Free disk space or move the build to a volume with sufficient capacity.
- On CI, verify the workspace user has write access to the project directory (chown/adjust runner permissions).
- Close IDE/antivirus handles locking files on Windows and retry.
Defensive patterns
Strategy: validation
Validate before calling
Path outDir = Path.of("target");
if (!Files.isDirectory(outDir) || !Files.isWritable(outDir)) {
throw new IllegalStateException("Build output directory missing or not writable: " + outDir.toAbsolutePath());
} Prevention
- Ensure the CI runner user owns the workspace and target/ is writable.
- Monitor disk space on build machines; expand or clean volumes as needed.
- Avoid pointing the build at read-only mounts.
- Run mvn clean if the output tree becomes corrupted.
When it happens
Trigger: Executing the Podman AOT image build (buildAotOptimizedContainerImageBuildItem) when Files.write cannot create/write outputDirectory/Dockerfile.aot — output directory does not exist and cannot be created, no write permission, disk full, or the path is a directory/file locked.
Common situations: Running the build from a read-only working directory or CI workspace with restricted permissions; disk quota exceeded on the machine running the build; target/ directory deleted or replaced by a file while the build runs; Windows file locks.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- Failed to build AOT enhanced container image:
- Unable to save enhanced Dockerfile contents to disk
- Error creating the openshift binary build archive.
- Unable to read entry: ${fileEntry.getName()} from jar: ${jar
- Failed to open path tree with root %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/ff5e1a5d2069325c.
Report an issue: GitHub.