quarkusio/quarkus · error · java.lang.RuntimeException
The tree root has not been provided
Error message
The tree root has not been provided
What it means
PathTreeBuilder.build() throws RuntimeException('The tree root has not been provided') when neither a root path nor a roots collection was set on the builder before building. It is a programming/configuration mistake: the builder cannot construct a PathTree without a root.
Source
Thrown at independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathTreeBuilder.java:68
public PathTreeBuilder exclude(String expr) {
if (excludes == null) {
excludes = new ArrayList<>(1);
}
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
- Call the builder's root setter (e.g. .setRoot(path)) before build().
- Fail fast when configured source is missing: check config before building and skip or error explicitly.
- Validate builder configuration with an assert/check prior to build().
- Catch RuntimeException only at a boundary where a partially-configured builder is tolerated.
Example fix
// before
PathTree tree = PathTreeBuilder.builder().build(); // RuntimeException: no root
// after
if (cfg.sourceDir == null) {
throw new IllegalStateException("sourceDir must be configured");
}
PathTree tree = PathTreeBuilder.builder().setRoot(cfg.sourceDir).build(); Defensive patterns
Strategy: validation
Validate before calling
PathTreeBuilder builder = PathTreeBuilder.builder();
if (root != null) {
builder.setRoot(root);
} else {
throw new IllegalStateException("No root configured for path tree");
}
PathTree tree = builder.build(); Type guard
static boolean isReadyToBuild(PathTreeBuilder b) {
return b != null && b.getRoot() != null; // if accessor available
} Try / catch
try {
PathTree tree = builder.build();
} catch (RuntimeException e) {
if ("The tree root has not been provided".equals(e.getMessage())) {
throw new IllegalStateException("PathTreeBuilder used without setRoot(); check configuration wiring", e);
}
throw e;
} Prevention
- Always call setRoot(...) in the same expression chain as build().
- Validate configuration before building; skip building entirely when the source is absent.
- Avoid resetting/clearing builder state between setRoot and build.
- Wrap builder construction in a small factory method that enforces root presence.
When it happens
Trigger: Calling build() on a PathTreeBuilder created without calling any root-setting method (e.g. PathTreeBuilder.builder().build()), or after root was reset/cleared.
Common situations: Programmatically building path trees from optional config where the config was absent, leaving the root null; refactoring that dropped the setRoot/setCurrentRoot call; conditional logic that skips root assignment on some code path.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- does not exist
- One of either visitorFunction or inputTransformer must be se
- name cannot be null
- Predicate already set
- Location already set
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/d75a9c2938f48eb9.
Report an issue: GitHub.