{"record":{"id":"fe04c206b3173894","repo":"quarkusio/quarkus","slug":"unable-to-validate-specified-dockerfile-s","errorCode":null,"errorMessage":"Unable to validate specified Dockerfile: '%s'","messagePattern":"Unable to validate specified Dockerfile: '(.+?)'","errorType":"console","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/ApplyDockerfileToBuildConfigDecorator.java","lineNumber":48,"sourceCode":"        if (!file.exists()) {\n            throw new IllegalArgumentException(\n                    \"Specified Dockerfile: '\" + pathToDockerfile.toAbsolutePath().toString() + \"' does not exist.\");\n        }\n        if (!file.isFile()) {\n            throw new IllegalArgumentException(\n                    \"Specified Dockerfile: '\" + pathToDockerfile.toAbsolutePath().toString() + \"' is not a normal file.\");\n        }\n\n        try {\n            Stream<String> lines = Files.lines(pathToDockerfile);\n            Optional<String> fromLine = lines.filter(l -> !l.startsWith(\"#\")).map(String::trim)\n                    .filter(l -> l.startsWith(\"FROM\")).findFirst();\n            if (!fromLine.isPresent()) {\n                throw new IllegalArgumentException(\"Specified Dockerfile: '\" + pathToDockerfile.toAbsolutePath().toString()\n                        + \"' does not contain a FROM directive\");\n            }\n        } catch (IOException e) {\n            throw new IllegalArgumentException(\n                    \"Unable to validate specified Dockerfile: '\" + pathToDockerfile.toAbsolutePath().toString() + \"'\");\n        }\n    }\n\n    @Override\n    public void andThenVisit(final BuildConfigSpecFluent<?> spec, ObjectMeta meta) {\n        try (InputStream is = new FileInputStream(pathToDockerfile.toFile())) {\n            spec.withNewSource()\n                    .withDockerfile(new String(FileUtil.readFileContents(is)))\n                    .endSource()\n                    .withNewStrategy()\n                    .withNewDockerStrategy()\n                    .endDockerStrategy()\n                    .endStrategy();\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/container-image/container-image-openshift/deployment/src/main/java/io/quarkus/container/image/openshift/deployment/ApplyDockerfileToBuildConfigDecorator.java#L30-L66","documentation":"If reading the Dockerfile lines throws an IOException during the FROM-directive scan, validate() throws IllegalArgumentException(\"Unable to validate specified Dockerfile: '<path>'\"). Note the IOException cause is dropped (not chained), so only the path is reported — the underlying issue is an I/O error while opening/reading the file (permissions, I/O failure, race with deletion).","triggerScenarios":"Files.lines(pathToDockerfile) fails: unreadable permissions, file deleted between the exists() check and the read, I/O errors on network filesystems, or the path being a unreadable special file that passed the earlier checks.","commonSituations":"Running the build as a user without read permission on the Dockerfile, NFS/CI volume flakiness, file removed concurrently by a clean step, SELinux denying read access in containerized CI.","solutions":["Check read permissions on the Dockerfile for the user running the build (chmod a+r)","Re-run the build to rule out a transient race with a concurrent clean/delete","Inspect filesystem health (dmesg / mount) if on NFS or CI volumes; check SELinux denials (ausearch -m avc)","As a diagnostic, cat the exact absolute path printed in the message"],"exampleFix":"# before: unreadable Dockerfile in CI\n-rw------- 1 root root Dockerfile\n// after: make it readable for the build user\n# chmod 644 src/main/docker/Dockerfile","handlingStrategy":"try-catch","validationCode":"// ensure the Dockerfile is readable before the build\njava.nio.file.Path df = java.nio.file.Path.of(dockerfileConfig);\nif (!java.nio.file.Files.isReadable(df)) {\n    throw new IllegalStateException(\"Dockerfile not readable: \" + df.toAbsolutePath());\n}","typeGuard":null,"tryCatchPattern":"try {\n    openshiftBuild();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Unable to validate specified Dockerfile\")) {\n        // cause is swallowed by the library — check permissions/FS manually\n        throw new IllegalStateException(\"I/O error reading \" + dockerfileConfig + \": check permissions, SELinux, NFS\", e);\n    }\n    throw e;\n}","preventionTips":["Ensure the build user can read the Dockerfile (chmod 644)","Avoid deleting/cleaning the Dockerfile while the build runs","Check SELinux/AVC denials in containerized CI environments","Watch filesystem health on NFS-mounted CI workspaces"],"tags":["openshift","dockerfile","ioexception","permissions"],"backgroundTag":"file-read-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"}