{"record":{"id":"3bda7a412127910a","repo":"quarkusio/quarkus","slug":"failed-to-locate-quarkus-properties-on-the-classpa","errorCode":null,"errorMessage":"Failed to locate quarkus.properties on the classpath","messagePattern":"Failed to locate quarkus\\.properties on the classpath","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"devtools/cli-common/src/main/java/io/quarkus/cli/common/VersionHelper.java","lineNumber":25,"sourceCode":"import java.util.Properties;\n\nimport io.quarkus.runtime.util.ClassPathUtils;\n\n/**\n * Helper class to get client version without circular dependencies\n */\npublic class VersionHelper {\n    private static String version;\n\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        }","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/cli-common/src/main/java/io/quarkus/cli/common/VersionHelper.java#L7-L43","documentation":"VersionHelper.clientVersion reads quarkus.properties from the classpath to report the Quarkus client version. If the context ClassLoader cannot locate that resource, it throws a RuntimeException stating the properties file is missing — indicating a broken/incomplete CLI distribution or packaging.","triggerScenarios":"Calling VersionHelper.clientVersion() (used by CLI commands reporting versions) when the runtime classpath contains no quarkus.properties resource, i.e. quarkusPropertiesUrl == null.","commonSituations":"Running the CLI from a partially built or repackaged jar where resource filtering/packaging was skipped; shaded/fat-jar builds excluding the properties file; executing classes outside the normal CLI launcher (e.g. from an IDE without the CLI resources on the classpath).","solutions":["Rebuild/reinstall the Quarkus CLI (e.g. via jbang or the installer) so the packaged quarkus.properties is present.","If building locally, run the full Maven build for devtools/cli so resource filtering includes quarkus.properties.","Check the launcher's classpath: run via the official `quarkus` entry point rather than invoking the jar class manually."],"exampleFix":"// before (broken packaging)\nmvn -f devtools/cli package -DskipResources\n// after\n./mvnw install -f devtools/cli -DskipTests","handlingStrategy":"try-catch","validationCode":"URL u = Thread.currentThread().getContextClassLoader().getResource(\"quarkus.properties\");\nif (u == null) {\n    throw new IllegalStateException(\"quarkus.properties missing; reinstall/repair the Quarkus CLI\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    String v = VersionHelper.clientVersion();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Failed to locate quarkus.properties\")) {\n        log.warn(\"Broken CLI installation; bypassing version lookup\");\n    } else throw e;\n}","preventionTips":["Launch the CLI via its official entry point, not by invoking classes directly.","Rebuild with full resource processing (no -DskipResources style shortcuts).","After upgrading, verify the jar contains quarkus.properties (unzip -l).","Avoid custom shaded/fat-jar packaging that strips unfiltered resources."],"tags":["cli","classpath","missing-resource","versioning"],"backgroundTag":"missing-classpath-resource","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"}