quarkusio/quarkus · error · java.lang.IllegalArgumentException
does not exist
Error message
does not exist
What it means
PathTreeBuilder.build() verifies the configured root exists on disk and throws IllegalArgumentException '<root> does not exist' when it does not. The root was provided (otherwise you'd get 'The tree root has not been provided') but points to a missing file/directory.
Source
Thrown at independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathTreeBuilder.java:71
}
excludes.add(expr);
return this;
}
List<String> getExcludes() {
return excludes;
}
PathFilter getPathFilter() {
return includes == null && excludes == null ? null : new PathFilter(includes, excludes);
}
public PathTree build() {
if (root == null) {
throw new RuntimeException("The tree root has not been provided");
}
if (!Files.exists(root)) {
throw new IllegalArgumentException(root + " does not exist");
}
if (archive) {
return ArchivePathTree.forPath(root, getPathFilter(), manifestEnabled == null ? true : manifestEnabled);
}
if (Files.isDirectory(root)) {
return new DirectoryPathTree(root, getPathFilter(), manifestEnabled == null ? false : manifestEnabled);
}
return new FilePathTree(root, getPathFilter());
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Check Files.exists(root) before build() and report a clear error including the resolved absolute path (root.toAbsolutePath()).
- Fix the configured path value or create the directory/file before building.
- Ensure build ordering produces the target path before this code runs.
- Catch IllegalArgumentException if absence is an expected, recoverable state.
Example fix
// before
PathTree tree = PathTreeBuilder.builder().setRoot(genDir).build();
// after
if (!Files.exists(genDir)) {
Files.createDirectories(genDir); // or fail with a clear message
}
PathTree tree = PathTreeBuilder.builder().setRoot(genDir).build(); Defensive patterns
Strategy: validation
Validate before calling
if (root != null && !Files.exists(root)) {
throw new IllegalStateException("PathTreeBuilder root does not exist: " + root.toAbsolutePath());
} Type guard
static boolean isBuildableRoot(Path root) {
return root != null && Files.exists(root);
} Try / catch
try {
PathTree tree = builder.build();
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().endsWith("does not exist")) {
log.errorf("Configured root missing; resolved to %s", String.valueOf(root));
}
throw e;
} Prevention
- Log root.toAbsolutePath() in errors to expose working-directory mismatches.
- Create directories with Files.createDirectories when the root should exist by then.
- Check build ordering so the target path exists before path-tree construction.
- Avoid environment-specific absolute paths in config; use relative, resolved paths.
When it happens
Trigger: Calling build() after setRoot(path) where Files.exists(root) is false — path typo, deleted target file, wrong working directory, or a directory created later in the build.
Common situations: Wiring a path tree to a build output (e.g. classes or generated-sources dir) that hasn't been produced yet; paths configured with environment-specific absolute values; running tests from a different module directory.
Related errors
- does not exist
- Predicate already set
- Location already set
- The tree root has not been provided
- Expected a path relative to the root of the path tree but go
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/4c5322a81cb25d2a.
Report an issue: GitHub.