quarkusio/quarkus · error · UncheckedIOException
Unable to read entry: ${fileEntry.getName()} from jar: ${jar
Error message
Unable to read entry: ${fileEntry.getName()} from jar: ${jarFile} What it means
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.
Source
Thrown at independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/AotSerializedApplication.java:239
private static class ServiceLoaderFileJarVisitor implements JarVisitor {
private final Map<String, List<byte[]>> serviceFiles = new LinkedHashMap<>();
public Map<String, List<byte[]>> getServiceFiles() {
return serviceFiles;
}
@Override
public void visitJarFileEntry(JarFile jarFile, ZipEntry fileEntry) {
if (!isServiceFile(fileEntry.getName())) {
return;
}
try (var is = jarFile.getInputStream(fileEntry)) {
serviceFiles.computeIfAbsent(fileEntry.getName(), k -> new ArrayList<>())
.add(is.readAllBytes());
} catch (IOException e) {
throw new UncheckedIOException("Unable to read entry: " + fileEntry.getName() + " from jar: " + jarFile, e);
}
}
@Override
public void visitRegularFile(Path jar, Path file, String relativePath) {
if (!isServiceFile(relativePath)) {
return;
}
try {
serviceFiles.computeIfAbsent(relativePath, k -> new ArrayList<>())
.add(Files.readAllBytes(file));
} catch (IOException e) {
throw new UncheckedIOException("Unable to read file: " + relativePath, e);
}
}
private static boolean isServiceFile(String resourcePath) {View on GitHub (pinned to e1c734241f)
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.
Example fix
// before mvn package // fails reading entry from corrupted jar // after rm -rf ~/.m2/repository/com/example/corrupted-artifact mvn clean install -U && mvn package
Defensive patterns
Strategy: validation
Validate before calling
try (JarFile jar = new JarFile(jarPath)) {
java.util.Enumeration<JarEntry> e = jar.entries();
while (e.hasMoreElements()) {
JarEntry je = e.nextElement();
if (je.getName().startsWith("META-INF/services/")) {
try (InputStream is = jar.getInputStream(je)) { is.readAllBytes(); }
}
}
} catch (IOException ex) {
throw new IllegalStateException("Jar unreadable/corrupted: " + jarPath, ex);
} Try / catch
try {
buildAotCache();
} catch (UncheckedIOException e) {
if (e.getMessage().startsWith("Unable to read entry")) {
throw new IllegalStateException("Dependency jar corrupted; remove it from ~/.m2 and rebuild with -U", e);
} throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unable to read entry: ${configFileName} from jar: ${jarFile}
- Failed to read zip entry ${res}
- Failed to process
- Unable to save enhanced Dockerfile contents to disk
- Failed to read
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/85999bae9c76c343.
Report an issue: GitHub.