{"record":{"id":"15d34ca08d30862c","repo":"quarkusio/quarkus","slug":"failed-to-read-content-of-dep","errorCode":null,"errorMessage":"Failed to read content of ${dep}","messagePattern":"Failed to read content of (.+?)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarTreeShakeProcessor.java","lineNumber":237,"sourceCode":"        }\n        for (NativeImageConfigBuildItem item : nativeImageConfigs) {\n            for (String className : item.getRuntimeInitializedClasses()) {\n                roots.produce(new JarTreeShakeRootClassBuildItem(className));\n            }\n        }\n\n        for (ResolvedDependency dep : curateOutcome.getApplicationModel().getDependencies(DependencyFlags.RUNTIME_CP)) {\n            try (OpenPathTree openTree = dep.getContentTree().open()) {\n                openTree.walkIfContains(META_INF_NATIVE_IMAGE, visit -> {\n                    String path = visit.getResourceName();\n                    if (path.endsWith(\"native-image.properties\")) {\n                        parseNativeImageProperties(visit.getPath(), roots);\n                    } else if (path.endsWith(\"reflect-config.json\") || path.endsWith(\"jni-config.json\")) {\n                        parseJsonClassConfig(visit.getPath(), roots);\n                    }\n                });\n            } catch (IOException e) {\n                throw new UncheckedIOException(\"Failed to read content of \" + dep.toCompactCoords(), e);\n            }\n        }\n    }\n\n    /**\n     * Parses a {@code native-image.properties} file and extracts class names from\n     * {@code --initialize-at-run-time}, {@code --initialize-at-build-time}, and\n     * {@code --features} arguments.\n     */\n    private static void parseNativeImageProperties(java.nio.file.Path file,\n            BuildProducer<JarTreeShakeRootClassBuildItem> roots) {\n        try (BufferedReader reader = new BufferedReader(\n                new InputStreamReader(Files.newInputStream(file), StandardCharsets.UTF_8))) {\n            StringBuilder args = new StringBuilder();\n            String line;\n            while ((line = reader.readLine()) != null) {\n                line = line.trim();\n                if (line.startsWith(\"#\") || line.isEmpty()) {","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarTreeShakeProcessor.java#L219-L255","documentation":"collectNativeImageConfigRoots walks a dependency jar's entries to collect native-image configuration (native-image.properties, reflect-config.json, jni-config.json). If iterating the jar's entries throws an IOException — typically a corrupt or unreadable jar — it is wrapped in UncheckedIOException naming the dependency via toCompactCoords().","triggerScenarios":"Jar tree-shaking is enabled and the step visits a dependency whose jar file cannot be opened or streamed: corrupt download, zero-byte jar, unreadable file permissions, or a file replaced mid-read.","commonSituations":"Interrupted Maven downloads leaving truncated jars in ~/.m2; snapshot dependencies re-written while building; read-only or locked files on Windows; corrupted corporate-mirror artifacts.","solutions":["Delete the named dependency from the local repository (~/.m2/repository/<group>/<artifact>) and rebuild with -U to re-download.","Verify the jar with jar tf <file> — replace it if listing fails.","Check file permissions/locks on the dependency jar path.","If using SNAPSHOT dependencies, stop concurrent processes that rewrite them during the build.","Disable/verify any proxy or mirror that could serve truncated artifacts."],"exampleFix":"# before\nrm -rf ~/.m2/repository/org/acme/broken-lib/1.0.0\n# after\n$ ./mvnw -U clean package  # re-downloads the dependency cleanly","handlingStrategy":"try-catch","validationCode":"import java.util.jar.*;\nimport java.io.*;\nFile jar = new File(\"~/.m2/repository/.../dep-1.0.jar\"); // path named in the error\ntry (JarFile jf = new JarFile(jar)) {\n    // OK: jar readable\n} catch (IOException e) {\n    throw new IllegalStateException(\"Corrupt dependency jar — delete it from ~/.m2 and rebuild with -U\", e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    // build with jar tree-shaking enabled\n} catch (UncheckedIOException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Failed to read content of\")) {\n        // parse dep coords after 'Failed to read content of ', purge from ~/.m2, rebuild with -U\n    } else throw e;\n}","preventionTips":["Use -U after network interruptions to fix truncated downloads.","Avoid concurrent snapshot rewrites during builds.","Verify suspect jars with 'jar tf'.","Prefer release versions over snapshots for reproducible builds."],"tags":["tree-shaking","native-image","jar-corruption"],"backgroundTag":"file-read-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}