{"record":{"id":"22ee1576dcac969c","repo":"quarkusio/quarkus","slug":"unable-to-save-enhanced-dockerfile-contents-to-dis","errorCode":null,"errorMessage":"Unable to save enhanced Dockerfile contents to disk","messagePattern":"Unable to save enhanced Dockerfile contents to disk","errorType":"console","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions/container-image/container-image-docker/deployment/src/main/java/io/quarkus/container/image/docker/deployment/DockerProcessor.java","lineNumber":257,"sourceCode":"        Path outputDirectory = outputTargetBuildItem.getOutputDirectory();\n\n        Path aotFile = requestBuildItem.getAotFile();\n        String aotEnhancedDockerfileContent = \"\"\"\n                FROM %s\n\n                # Add the app.aot file to the working directory\n                COPY %s %s\n\n                # Set the JAVA_TOOL_OPTIONS environment variable\n                ENV JAVA_TOOL_OPTIONS=\"-XX:AOTCache=%s\"\n                \"\"\".formatted(baseImage, outputDirectory.relativize(aotFile).toString().replace('\\\\', '/'),\n                requestBuildItem.getContainerWorkingDirectory(), aotFile.getFileName());\n\n        Path aotEnhancedDockerfile = outputDirectory.resolve(\"Dockerfile.aot\");\n        try {\n            Files.write(aotEnhancedDockerfile, aotEnhancedDockerfileContent.getBytes());\n        } catch (IOException e) {\n            throw new UnsupportedOperationException(\"Unable to save enhanced Dockerfile contents to disk\", e);\n        }\n\n        boolean pushContainerImage = containerImageConfig.isPushExplicitlyEnabled();\n\n        String executableName = getExecutableName(dockerConfig, ContainerRuntime.DOCKER, ContainerRuntime.PODMAN);\n        var dockerBuildArgs = getDockerBuildArgs(enhancedImage, new DockerfilePaths() {\n            @Override\n            public Path dockerfilePath() {\n                return aotEnhancedDockerfile;\n            }\n\n            @Override\n            public Path dockerExecutionPath() {\n                return outputDirectory;\n            }\n        }, containerImageConfig,\n                dockerConfig, pushContainerImage, executableName, Collections.emptyList());\n","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/container-image/container-image-docker/deployment/src/main/java/io/quarkus/container/image/docker/deployment/DockerProcessor.java#L239-L275","documentation":"During AOT-optimized container image building, Quarkus generates a Dockerfile.aot that wraps the base image with AOT cache instructions. It writes this file into the build output directory with Files.write; if the filesystem write fails (IOException), the build is aborted with this UnsupportedOperationException wrapping the cause.","triggerScenarios":"Running a container-image build with AOT optimization enabled (quarkus.native.aot... / AOT request build item) while the output directory is not writable, is read-only, has been deleted, is on a full disk, or the path resolves to a directory that cannot be created.","commonSituations":"Building in a CI container with a read-only workspace, disk quota exhausted, output/target directory cleaned by a concurrent process, or permission-restricted build agents (e.g. non-root user in /workspace owned by root).","solutions":["Check free disk space on the volume holding target/ (or the configured output directory)","Verify the output directory is writable by the user running the Maven/Gradle build (chown/chmod as needed)","Remove the stale or read-only target/ directory and rebuild","Check the wrapped IOException in the stack trace for the exact OS reason (e.g. 'No space left on device', 'Read-only file system')"],"exampleFix":"# before: read-only mount\n-v /ro-workspace:/project\n# after: writable mount\n-v /home/ci/workspace:/project","handlingStrategy":"validation","validationCode":"Path out = Paths.get(\"target\");\nif (!Files.isDirectory(out) || !Files.isWritable(out)\n        || out.toFile().getUsableSpace() < 50 * 1024 * 1024) {\n    throw new IllegalStateException(\"Output dir missing, read-only, or low on disk space\");\n}","typeGuard":"boolean canWriteDockerfile(Path dir) {\n    return Files.isDirectory(dir) && Files.isWritable(dir);\n}","tryCatchPattern":"try {\n    Files.write(aotEnhancedDockerfile, content.getBytes());\n} catch (IOException e) {\n    throw new UncheckedIOException(\"Cannot write Dockerfile.aot to \" + aotEnhancedDockerfile, e);\n}","preventionTips":["Ensure the build workspace volume is writable and not mounted read-only in CI","Monitor free disk space on build agents","Avoid concurrent builds sharing the same target/ directory","Run builds as a user that owns the workspace"],"tags":["container-image","docker","filesystem","io"],"backgroundTag":"dockerfile-write-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}