{"record":{"id":"3ec6e5d2f69d7dc1","repo":"quarkusio/quarkus","slug":"rootpath-is-null-for","errorCode":null,"errorMessage":"rootPath is null for ","messagePattern":"rootPath is null for ","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/OpenContainerPathTree.java","lineNumber":65,"sourceCode":"     * This is the path to the container.\n     * <p>\n     * In the case of a zip archive, it's the path to the root of the archive (i.e. a ZipPath).\n     * In the case of a directory, it's the directory.\n     * <p>\n     * Should be used for any read operation on the container.\n     */\n    protected abstract Path getRootPath();\n\n    @Override\n    public OpenPathTree open() {\n        return this;\n    }\n\n    @Override\n    public Collection<Path> getRoots() {\n        final Path rootPath = getRootPath();\n        if (rootPath == null) {\n            throw new RuntimeException(\"rootPath is null for \" + getContainerPath());\n        }\n        return List.of(rootPath);\n    }\n\n    @Override\n    public void walk(PathVisitor visitor) {\n        final Path rootPath = getRootPath();\n        if (!Files.exists(rootPath)) {\n            return;\n        }\n        PathTreeVisit.walk(getContainerPath(), rootPath, rootPath, pathFilter, getMultiReleaseMapping(),\n                visitor);\n\n    }\n\n    @Override\n    public void walkRaw(PathVisitor visitor) {\n        final Path rootPath = getRootPath();","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/OpenContainerPathTree.java#L47-L83","documentation":"OpenContainerPathTree.getRoots() resolves the container's root path; if the underlying archive/directory could not be opened (the open container has no root), it throws a plain RuntimeException. This signals that the tree was constructed for a path that failed to open, so the root does not exist.","triggerScenarios":"Calling getRoots() (or walk/apply consumers that use it) on an OpenContainerPathTree whose getRootPath() returned null — typically because the archive file disappeared or failed to open when the tree was created.","commonSituations":"A dependency JAR was deleted from the local Maven repo or a fat-jar/lib directory while the application was running; caching an OpenContainerPathTree across builds where the underlying archive was cleaned.","solutions":["Verify the container path (printed in the message) exists before creating/using the tree: Files.exists(containerPath).","Re-create the PathTree from a fresh Path if the archive was rebuilt or moved.","If you cache trees, invalidate the cache when the underlying file's timestamp/size changes.","Guard usage with isOpen()/getRootPath() null-check when available instead of catching the RuntimeException."],"exampleFix":"// before\nOpenContainerPathTree tree = OpenContainerPathTree.forPath(jarPath);\nPath root = tree.getRoots().iterator().next(); // RuntimeException if not open\n// after\nOpenContainerPathTree tree = OpenContainerPathTree.forPath(jarPath);\nif (tree.getRootPath() == null) {\n    throw new IllegalStateException(\"Archive failed to open: \" + jarPath);\n}\nPath root = tree.getRoots().iterator().next();","handlingStrategy":"validation","validationCode":"if (!Files.isRegularFile(containerPath)) {\n    throw new IllegalStateException(\"Container missing: \" + containerPath);\n}\nOpenContainerPathTree tree = OpenContainerPathTree.forPath(containerPath);\nif (tree.getRootPath() == null) {\n    throw new IllegalStateException(\"Failed to open: \" + containerPath);\n}","typeGuard":"static boolean hasRoot(OpenContainerPathTree tree) {\n    return tree != null && tree.getRootPath() != null;\n}","tryCatchPattern":"try {\n    Collection<Path> roots = tree.getRoots();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"rootPath is null\")) {\n        // re-create tree from a fresh Path\n    } else {\n        throw e;\n    }\n}","preventionTips":["Verify the archive exists before creating the tree.","Do not cache OpenContainerPathTree instances across rebuilds of the archive.","Re-create trees from fresh Paths when files may have been replaced.","Prefer checking getRootPath()/isOpen over catching the generic RuntimeException."],"tags":["quarkus-paths","archive","null-root","classpath"],"backgroundTag":"null-path-root","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"}