{"record":{"id":"85999bae9c76c343","repo":"quarkusio/quarkus","slug":"unable-to-read-entry-fileentry-getname-from","errorCode":null,"errorMessage":"Unable to read entry: ${fileEntry.getName()} from jar: ${jarFile}","messagePattern":"Unable to read entry: (.+?) from jar: (.+?)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/AotSerializedApplication.java","lineNumber":239,"sourceCode":"    private static class ServiceLoaderFileJarVisitor implements JarVisitor {\n\n        private final Map<String, List<byte[]>> serviceFiles = new LinkedHashMap<>();\n\n        public Map<String, List<byte[]>> getServiceFiles() {\n            return serviceFiles;\n        }\n\n        @Override\n        public void visitJarFileEntry(JarFile jarFile, ZipEntry fileEntry) {\n            if (!isServiceFile(fileEntry.getName())) {\n                return;\n            }\n\n            try (var is = jarFile.getInputStream(fileEntry)) {\n                serviceFiles.computeIfAbsent(fileEntry.getName(), k -> new ArrayList<>())\n                        .add(is.readAllBytes());\n            } catch (IOException e) {\n                throw new UncheckedIOException(\"Unable to read entry: \" + fileEntry.getName() + \" from jar: \" + jarFile, e);\n            }\n        }\n\n        @Override\n        public void visitRegularFile(Path jar, Path file, String relativePath) {\n            if (!isServiceFile(relativePath)) {\n                return;\n            }\n\n            try {\n                serviceFiles.computeIfAbsent(relativePath, k -> new ArrayList<>())\n                        .add(Files.readAllBytes(file));\n            } catch (IOException e) {\n                throw new UncheckedIOException(\"Unable to read file: \" + relativePath, e);\n            }\n        }\n\n        private static boolean isServiceFile(String resourcePath) {","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/AotSerializedApplication.java#L221-L257","documentation":"While building the AOT cache, AotSerializedApplication's jar visitor reads service-loader descriptor entries (META-INF/services/*) from each jar. If getInputStream()/readAllBytes() on a jar entry fails with IOException, it is wrapped in an UncheckedIOException naming the entry and jar file. This means a jar in the application is unreadable or corrupted at packaging time.","triggerScenarios":"visitJarFileEntry encountering a corrupted/truncated jar, a jar file being modified or deleted mid-build, or I/O permission errors while reading a META-INF/services entry during AOT cache generation.","commonSituations":"Corrupted dependencies in the local Maven repository, concurrent builds writing to the same directory, antivirus or file-lock interference on Windows, or damaged jars in a fat/runner jar assembly.","solutions":["Delete the corrupted dependency from the local repository (~/.m2/repository) and re-download it (mvn clean install -U).","Re-run the package build after stopping any process that may lock or modify the jar files.","Verify jar integrity (unzip -t) to identify which dependency jar is damaged, then replace it."],"exampleFix":"// before\nmvn package // fails reading entry from corrupted jar\n\n// after\nrm -rf ~/.m2/repository/com/example/corrupted-artifact\nmvn clean install -U && mvn package","handlingStrategy":"validation","validationCode":"try (JarFile jar = new JarFile(jarPath)) {\n    java.util.Enumeration<JarEntry> e = jar.entries();\n    while (e.hasMoreElements()) {\n        JarEntry je = e.nextElement();\n        if (je.getName().startsWith(\"META-INF/services/\")) {\n            try (InputStream is = jar.getInputStream(je)) { is.readAllBytes(); }\n        }\n    }\n} catch (IOException ex) {\n    throw new IllegalStateException(\"Jar unreadable/corrupted: \" + jarPath, ex);\n}","typeGuard":null,"tryCatchPattern":"try {\n    buildAotCache();\n} catch (UncheckedIOException e) {\n    if (e.getMessage().startsWith(\"Unable to read entry\")) {\n        throw new IllegalStateException(\"Dependency jar corrupted; remove it from ~/.m2 and rebuild with -U\", e);\n    } throw e;\n}","preventionTips":["Run mvn with -U after suspecting corrupted downloads.","Avoid concurrent builds sharing the same target directory.","Verify dependency jar integrity (unzip -t) when I/O errors appear at packaging."],"tags":["aot","jar","io","corruption"],"backgroundTag":"unreadable-jar-entry","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"}