{"record":{"id":"789fdd3daeebaad9","repo":"quarkusio/quarkus","slug":"failed-to-load-quarkus-properties","errorCode":null,"errorMessage":"Failed to load quarkus.properties","messagePattern":"Failed to load quarkus\\.properties","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"devtools/cli-common/src/main/java/io/quarkus/cli/common/VersionHelper.java","lineNumber":34,"sourceCode":"\n    public static String clientVersion() {\n        if (version != null) {\n            return version;\n        }\n\n        final Properties props = new Properties();\n        final URL quarkusPropertiesUrl = Thread.currentThread().getContextClassLoader().getResource(\"quarkus.properties\");\n        if (quarkusPropertiesUrl == null) {\n            throw new RuntimeException(\"Failed to locate quarkus.properties on the classpath\");\n        }\n\n        // we have a special case for file and jar as using getResourceAsStream() on Windows might cause file locks\n        if (\"file\".equals(quarkusPropertiesUrl.getProtocol()) || \"jar\".equals(quarkusPropertiesUrl.getProtocol())) {\n            ClassPathUtils.consumeAsPath(quarkusPropertiesUrl, p -> {\n                try (BufferedReader reader = Files.newBufferedReader(p)) {\n                    props.load(reader);\n                } catch (IOException e) {\n                    throw new RuntimeException(\"Failed to load quarkus.properties\", e);\n                }\n            });\n        } else {\n            try {\n                props.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(\"quarkus.properties\"));\n            } catch (IOException e) {\n                throw new IllegalStateException(\"Failed to load quarkus.properties\", e);\n            }\n        }\n\n        version = props.getProperty(\"quarkus-core-version\");\n        if (version == null) {\n            throw new RuntimeException(\"Failed to locate quarkus-core-version property in the bundled quarkus.properties\");\n        }\n\n        return version;\n    }\n}","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/cli-common/src/main/java/io/quarkus/cli/common/VersionHelper.java#L16-L52","documentation":"In clientVersion(), once quarkus.properties is found, its contents are loaded; an IOException while reading (file/jar protocol path or the generic getResourceAsStream branch) is wrapped in a RuntimeException 'Failed to load quarkus.properties'. This signals the version metadata exists but is unreadable/corrupt.","triggerScenarios":"quarkus.properties exists on the classpath but reading it throws IOException — e.g. file locked or unreadable on disk (Windows file-lock is why the file/jar special case exists), truncated jar entry, permission denied, or getResourceAsStream returning a stream that fails mid-load.","commonSituations":"Antivirus or another process locking the CLI jar on Windows; running from a network drive with flaky access; a corrupted local CLI installation; jar partially downloaded.","solutions":["Reinstall/refresh the Quarkus CLI to replace the corrupt or locked resource.","Close processes locking the jar (antivirus, editors) and retry, especially on Windows.","Verify filesystem permissions on the CLI installation directory and jar."],"exampleFix":"// before (locked/corrupt install)\nC:\\Users\\me\\.quarkus\\cli\\quarkus-cli.jar  // unreadable entry\n// after: reinstall\njbang app install --fresh quarkus@quarkusio","handlingStrategy":"try-catch","validationCode":"try (InputStream in = Thread.currentThread().getContextClassLoader()\n        .getResourceAsStream(\"quarkus.properties\")) {\n    if (in == null || in.read() == -1) {\n        throw new IllegalStateException(\"quarkus.properties unreadable or empty\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    String v = VersionHelper.clientVersion();\n} catch (RuntimeException e) {\n    if (e.getCause() instanceof IOException) {\n        log.warn(\"quarkus.properties unreadable (locked/corrupt); reinstalling recommended\");\n    } else throw e;\n}","preventionTips":["Exclude the CLI installation directory from antivirus real-time scanning.","Re-download/reinstall the CLI if the jar was partially transferred.","Ensure read permissions on the CLI install path.","Run from a local disk rather than flaky network shares."],"tags":["cli","io","properties-load","versioning"],"backgroundTag":"resource-io-failure","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"}