{"record":{"id":"26e406d1a3b35a64","repo":"quarkusio/quarkus","slug":"failed-to-locate-name-dir-on-the-classpath","errorCode":null,"errorMessage":"Failed to locate <name> dir on the classpath","messagePattern":"Failed to locate <name> dir on the classpath","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/descriptor/loader/json/DirectoryResourceLoader.java","lineNumber":22,"sourceCode":"import java.nio.file.Files;\nimport java.nio.file.Path;\n\npublic class DirectoryResourceLoader implements ResourceLoader {\n\n    private final Path dir;\n\n    public DirectoryResourceLoader(Path dir) {\n        if (!Files.isDirectory(dir)) {\n            throw new IllegalStateException(\"Failed to locate directory \" + dir);\n        }\n        this.dir = dir;\n    }\n\n    @Override\n    public <T> T loadResourceAsPath(String name, ResourcePathConsumer<T> consumer) throws IOException {\n        Path path = dir.resolve(name);\n        if (!Files.exists(path)) {\n            throw new IOException(\"Failed to locate \" + name + \" dir on the classpath\");\n        }\n        return consumer.consume(path);\n    }\n}\n","sourceCodeStart":4,"sourceCodeEnd":27,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/descriptor/loader/json/DirectoryResourceLoader.java#L4-L27","documentation":"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.","triggerScenarios":"loadResourceAsPath(name, consumer) where dir/name is absent — wrong relative name, resource not yet generated, or case-sensitivity mismatch on Linux filesystems.","commonSituations":"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.","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"],"exampleFix":"// before\nloader.loadResourceAsPath(\"quarkus-bom-descriptor.json\", c); // file is actually versioned\n// after\nloader.loadResourceAsPath(\"io/quarkus/platform/descriptor/json/quarkus-bom-quarkus-platform-descriptor-3.2.0.json\", c);","handlingStrategy":"validation","validationCode":"Path resolved = rootDir.resolve(name);\nif (!Files.exists(resolved)) {\n    throw new IllegalArgumentException(\"Missing resource in dir: \" + resolved);\n}","typeGuard":"boolean dirContains(Path root, String name) {\n    return Files.exists(root.resolve(name));\n}","tryCatchPattern":"try {\n    return loader.loadResourceAsPath(name, consumer);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"dir on the classpath\")) {\n        throw new MissingDescriptorException(name, e);\n    }\n    throw e;\n}","preventionTips":["Match exact filenames including version numbers and case","Remember Linux filesystems are case-sensitive","Regenerate local descriptor directories after platform version bumps"],"tags":["filesystem","io","resource-loading"],"backgroundTag":"classpath-resource-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}