{"record":{"id":"4aecbda6acb34810","repo":"quarkusio/quarkus","slug":"does-not-exist","errorCode":null,"errorMessage":" does not exist","messagePattern":" does not exist","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathTree.java","lineNumber":27,"sourceCode":"import java.util.Set;\nimport java.util.function.Consumer;\nimport java.util.function.Function;\n\n/**\n * Classpath resource set backed by file system paths.\n */\npublic interface PathTree {\n\n    static PathTree ofDirectoryOrFile(Path p) {\n        return ofDirectoryOrFile(p, null);\n    }\n\n    static PathTree ofDirectoryOrFile(Path p, PathFilter filter) {\n        try {\n            final BasicFileAttributes fileAttributes = Files.readAttributes(p, BasicFileAttributes.class);\n            return fileAttributes.isDirectory() ? new DirectoryPathTree(p, filter) : new FilePathTree(p, filter);\n        } catch (IOException e) {\n            throw new IllegalArgumentException(p + \" does not exist\", e);\n        }\n    }\n\n    /**\n     * Creates a new {@link PathTree} for a given existing path which is expected to be\n     * either a directory or a ZIP-based archive.\n     *\n     * @param p path to a directory or an archive\n     * @return an instance of {@link PathTree} for a given existing directory or an archive\n     */\n    static PathTree ofDirectoryOrArchive(Path p) {\n        return ofDirectoryOrArchive(p, null);\n    }\n\n    /**\n     * Creates a new {@link PathTree} for a given existing path which is expected to be\n     * either a directory or a ZIP-based archive applying a provided {@link PathFilter}\n     * unless it is {@code null}.","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathTree.java#L9-L45","documentation":"PathTree.ofDirectoryOrFile() stats the given path to decide whether to build a DirectoryPathTree or a FilePathTree. If reading the file attributes fails (the path does not exist or is not accessible), it throws IllegalArgumentException '<p> does not exist' wrapping the IOException.","triggerScenarios":"Calling PathTree.ofDirectoryOrFile(p, filter) with a Path that does not exist on disk (typo, wrong working directory, file deleted, unresolved placeholder in the path).","commonSituations":"Hardcoded absolute paths that differ between machines/CI; a resource directory not created by the build; running from a different working directory than expected; typos in configured output directories.","solutions":["Check Files.exists(p) before calling ofDirectoryOrFile and produce a clear error naming the missing path.","Fix the path value (verify with Files.exists / print it) — often a wrong working directory or unresolved variable.","Create the missing file/directory if it should exist by then.","Catch IllegalArgumentException from ofDirectoryOrFile if absence is a supported case and fall back."],"exampleFix":"// before\nPathTree tree = PathTree.ofDirectoryOrFile(cfg.outputDir, null); // IllegalArgumentException if absent\n// after\nif (!Files.exists(cfg.outputDir)) {\n    throw new IllegalStateException(\"Configured outputDir does not exist: \" + cfg.outputDir);\n}\nPathTree tree = PathTree.ofDirectoryOrFile(cfg.outputDir, null);","handlingStrategy":"validation","validationCode":"if (p == null || !Files.exists(p)) {\n    throw new IllegalStateException(\"Path does not exist: \" + p);\n}","typeGuard":"static boolean isExistingPath(Path p) {\n    return p != null && Files.exists(p);\n}","tryCatchPattern":"try {\n    PathTree tree = PathTree.ofDirectoryOrFile(p, filter);\n} catch (IllegalArgumentException e) {\n    log.warnf(\"Skipping non-existent path: %s\", p);\n    return PathTree.EMPTY;\n}","preventionTips":["Validate paths right after reading them from config; fail early with the absolute path.","Don't hardcode absolute paths; derive from working directory or module layout.","Ensure build steps create target directories before path trees are built.","Resolve symlinks/relative paths (toAbsolutePath().normalize()) before validation."],"tags":["illegal-argument","filesystem","quarkus-paths","missing-file"],"backgroundTag":"path-does-not-exist","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}