quarkusio/quarkus · error · IOException
Failed to locate <name> dir on the classpath
Error message
Failed to locate <name> dir on the classpath
What it means
DirectoryResourceLoader.loadResourceAsPath resolves `name` inside the loader's root directory and throws IOException if the resolved path doesn't exist. The root dir is valid but the specific requested resource is missing inside it.
Source
Thrown at independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/descriptor/loader/json/DirectoryResourceLoader.java:22
import java.nio.file.Files;
import java.nio.file.Path;
public class DirectoryResourceLoader implements ResourceLoader {
private final Path dir;
public DirectoryResourceLoader(Path dir) {
if (!Files.isDirectory(dir)) {
throw new IllegalStateException("Failed to locate directory " + dir);
}
this.dir = dir;
}
@Override
public <T> T loadResourceAsPath(String name, ResourcePathConsumer<T> consumer) throws IOException {
Path path = dir.resolve(name);
if (!Files.exists(path)) {
throw new IOException("Failed to locate " + name + " dir on the classpath");
}
return consumer.consume(path);
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- List the root directory and confirm the exact resource filename (watch case sensitivity)
- Regenerate or download the resource into the directory
- Use the correct versioned file name matching your platform version
- Check the loader's root dir is the one you intend
Example fix
// before
loader.loadResourceAsPath("quarkus-bom-descriptor.json", c); // file is actually versioned
// after
loader.loadResourceAsPath("io/quarkus/platform/descriptor/json/quarkus-bom-quarkus-platform-descriptor-3.2.0.json", c); Defensive patterns
Strategy: validation
Validate before calling
Path resolved = rootDir.resolve(name);
if (!Files.exists(resolved)) {
throw new IllegalArgumentException("Missing resource in dir: " + resolved);
} Type guard
boolean dirContains(Path root, String name) {
return Files.exists(root.resolve(name));
} Try / catch
try {
return loader.loadResourceAsPath(name, consumer);
} catch (IOException e) {
if (e.getMessage().contains("dir on the classpath")) {
throw new MissingDescriptorException(name, e);
}
throw e;
} Prevention
- Match exact filenames including version numbers and case
- Remember Linux filesystems are case-sensitive
- Regenerate local descriptor directories after platform version bumps
When it happens
Trigger: loadResourceAsPath(name, consumer) where dir/name is absent — wrong relative name, resource not yet generated, or case-sensitivity mismatch on Linux filesystems.
Common situations: Requesting a descriptor JSON from a local platform checkout that uses a different versioned filename; case-sensitive filesystem mismatch (Desc.json vs desc.json); file deleted between loader creation and use.
Related errors
- Failed to create output directory for generated sources: %s
- IOException (wrapped)
- Unable to validate the application root for remote-dev path:
- Unable to validate remote-dev path: <file>
- Cannot create directory ${directory}
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/26e406d1a3b35a64.
Report an issue: GitHub.