{"record":{"id":"1a0a48c74448ec23","repo":"quarkusio/quarkus","slug":"failed-to-locate-name-in-zip","errorCode":null,"errorMessage":"Failed to locate <name> in <zip>","messagePattern":"Failed to locate <name> in <zip>","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/descriptor/loader/json/ZipResourceLoader.java","lineNumber":23,"sourceCode":"import java.nio.file.Files;\nimport java.nio.file.Path;\n\nimport io.quarkus.fs.util.ZipUtils;\n\npublic class ZipResourceLoader implements ResourceLoader {\n\n    private final Path zip;\n\n    public ZipResourceLoader(Path zip) {\n        this.zip = zip;\n    }\n\n    @Override\n    public <T> T loadResourceAsPath(String name, ResourcePathConsumer<T> consumer) throws IOException {\n        try (FileSystem fs = ZipUtils.newFileSystem(zip)) {\n            final Path path = fs.getPath(\"/\", name);\n            if (!Files.exists(path)) {\n                throw new IOException(\"Failed to locate \" + name + \" in \" + zip);\n            }\n            return consumer.consume(path);\n        }\n    }\n\n}\n","sourceCodeStart":5,"sourceCodeEnd":30,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/descriptor/loader/json/ZipResourceLoader.java#L5-L30","documentation":"ZipResourceLoader.loadResourceAsPath opens the configured zip file as a FileSystem and looks up the named entry at its root. If the entry does not exist, an IOException 'Failed to locate <name> in <zip>' is thrown so the caller can fall back to another loader.","triggerScenarios":"Calling loadResourceAsPath(name, consumer) where name is not a path inside the zip — wrong resource name, wrong case, missing leading path segments, or the entry exists only in a newer/older version of the archive.","commonSituations":"Expecting quarkus-extension.yaml in a JAR that actually contains quarkus-extension.json (Quarkus <=1.x vs newer); typo in the resource path; the zip is a different artifact than assumed.","solutions":["List the archive contents (`unzip -l <zip>`) and confirm the exact entry name and case","Check the artifact version — the resource name may have changed across Quarkus versions (e.g. quarkus-extension.json vs .yaml)","Ensure `name` is an absolute path within the zip as expected by fs.getPath(\"/\", name)"],"exampleFix":"// before\nloader.loadResourceAsPath(\"quarkus-extension.yaml\", c); // entry is quarkus-extension.json\n// after\nloader.loadResourceAsPath(\"META-INF/quarkus-extension.json\", c);","handlingStrategy":"validation","validationCode":"static boolean zipContains(Path zip, String name) throws IOException {\n    try (FileSystem fs = ZipUtils.newFileSystem(zip)) {\n        return Files.exists(fs.getPath(\"/\", name));\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    return loader.loadResourceAsPath(name, consumer);\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"Failed to locate\")) {\n        return fallbackLoader.loadResourceAsPath(fallbackName(name), consumer); // e.g. .json variant\n    }\n    throw e;\n}","preventionTips":["Verify entry names/case with `unzip -l` before coding against them","Support historical resource names (quarkus-extension.json vs .yaml) with fallbacks","Pin the artifact version so the archive layout matches what your code expects"],"tags":["io","zip","missing-resource"],"backgroundTag":"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"}