{"record":{"id":"ab5169e4f30b9813","repo":"quarkusio/quarkus","slug":"unable-to-read-file-path","errorCode":null,"errorMessage":"Unable to read file + path","messagePattern":"Unable to read file \\+ path","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"extensions/tls-registry/runtime/src/main/java/io/quarkus/tls/runtime/config/TlsConfigUtils.java","lineNumber":53,"sourceCode":"     * @param path the path, must not be {@code null}\n     * @return the content of the file\n     */\n    public static byte[] read(Path path) {\n        byte[] data;\n        try {\n            final InputStream resource = Thread.currentThread().getContextClassLoader()\n                    .getResourceAsStream(ClassPathUtils.toResourceName(path));\n            if (resource != null) {\n                try (InputStream is = resource) {\n                    data = is.readAllBytes();\n                }\n            } else {\n                try (InputStream is = Files.newInputStream(path)) {\n                    data = is.readAllBytes();\n                }\n            }\n        } catch (IOException e) {\n            throw new UncheckedIOException(\"Unable to read file \" + path, e);\n        }\n        return data;\n    }\n\n    /**\n     * Apply common SSL properties from a {@link SSLOptions} to a {@link TCPSSLOptions}.\n     */\n    private static void applySSLOptions(TCPSSLOptions options, SSLOptions sslOptions) {\n        if (sslOptions != null) {\n            options.setSslHandshakeTimeout(sslOptions.getSslHandshakeTimeout());\n            options.setSslHandshakeTimeoutUnit(sslOptions.getSslHandshakeTimeoutUnit());\n            for (String suite : sslOptions.getEnabledCipherSuites()) {\n                options.addEnabledCipherSuite(suite);\n            }\n            for (Buffer buffer : sslOptions.getCrlValues()) {\n                options.addCrlValue(buffer);\n            }\n            options.setEnabledSecureTransportProtocols(sslOptions.getEnabledSecureTransportProtocols());","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/tls-registry/runtime/src/main/java/io/quarkus/tls/runtime/config/TlsConfigUtils.java#L35-L71","documentation":"TlsConfigUtils.read loads a file referenced by TLS configuration into a byte buffer. When Files.newInputStream(path) throws IOException (file missing, unreadable, is a directory), the IOException is wrapped in this UncheckedIOException.","triggerScenarios":"Any TLS config property pointing at a file path (key, cert, truststore, keystore) whose Path cannot be opened: file does not exist, no read permission, wrong working directory for relative paths, or path points to a directory.","commonSituations":"Typo in file name; relative path resolved against an unexpected base dir (dev vs test vs container); file not copied into the container/native image; permissions changed after deployment.","solutions":["Verify the file exists and is readable at the resolved path (ls -l / cat)","Use an absolute path or confirm the working directory the app runs with","If in a container/native image, ensure the file is included in the image and referenced by an absolute path","Check file permissions of the process user"],"exampleFix":"// before\nquarkus.tls.my-tls.trust-store.pem.0.cert=./certs/ca.pem\n// after (absolute path, guaranteed present)\nquarkus.tls.my-tls.trust-store.pem.0.cert=/etc/quarkus/certs/ca.pem","handlingStrategy":"validation","validationCode":"Path p = Path.of(configuredPath);\nif (!Files.isRegularFile(p) || !Files.isReadable(p)) {\n    throw new IllegalStateException(\"TLS file missing or unreadable: \" + p.toAbsolutePath());\n}","typeGuard":null,"tryCatchPattern":"try {\n    startApplication();\n} catch (UncheckedIOException e) {\n    if (e.getMessage().startsWith(\"Unable to read file\")) {\n        log.errorf(\"TLS file unreadable: %s — check path, packaging, permissions\", e.getCause());\n    }\n    throw e;\n}","preventionTips":["Use absolute paths for TLS files","Verify files exist at container startup (health/readiness check)","Ensure files are packaged in container/native images"],"tags":["io","filesystem","tls","config"],"backgroundTag":"file-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}