quarkusio/quarkus · error · RuntimeException
Failed to read all data for ${res}
Error message
Failed to read all data for ${res} What it means
A RuntimeException thrown while fully reading a jar entry's bytes: the stream signaled EOF (read == -1) before entry.getSize() bytes were consumed. Indicates the jar entry metadata disagrees with actual data — a corrupt or truncated zip entry.
Source
Thrown at independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/JarResource.java:84
}
private static class JarResourceDataProvider implements JarFileReference.JarFileConsumer<byte[]> {
private static final JarResourceDataProvider INSTANCE = new JarResourceDataProvider();
@Override
public byte[] apply(JarFile jarFile, Path path, String res) {
ZipEntry entry = jarFile.getEntry(res);
if (entry == null) {
return null;
}
try (InputStream is = jarFile.getInputStream(entry)) {
byte[] data = new byte[(int) entry.getSize()];
int pos = 0;
int rem = data.length;
while (rem > 0) {
int read = is.read(data, pos, rem);
if (read == -1) {
throw new RuntimeException("Failed to read all data for " + res);
}
pos += read;
rem -= read;
}
return data;
} catch (IOException e) {
throw new RuntimeException("Failed to read zip entry " + res, e);
}
}
}
@Override
public URL getResourceURL(String resource) {
return JarFileReference.withJarFile(this, resource, JarResourceURLProvider.INSTANCE);
}
private static class JarResourceURLProvider implements JarFileReference.JarFileConsumer<URL> {
private static final JarResourceURLProvider INSTANCE = new JarResourceURLProvider();View on GitHub (pinned to e1c734241f)
Solutions
- Validate the jar: unzip -t <jarPath>; replace it with a freshly built/installed copy (mvn clean install).
- Redeploy the application to replace a truncated jar on the target host.
- Check no process rewrote the jar while the app was running; stop, replace, restart.
- Verify checksums of copied artifacts against build output.
Example fix
// before scp target/quarkus-app/lib/app.jar host:/deploy/lib/ # interrupted // after scp target/quarkus-app/lib/app.jar host:/tmp/ && ssh host 'unzip -t /tmp/app.jar && mv /tmp/app.jar /deploy/lib/'
Defensive patterns
Strategy: validation
Validate before calling
try (var zf = new java.util.zip.ZipFile(jar.toFile())) {
for (var en = zf.entries(); en.hasMoreElements(); ) { if (!zf.getInputStream(en.nextElement()).transferTo(java.io.OutputStream.nullOutputStream())) return false; }
return true;
} Type guard
boolean jarEntriesIntact(Path p) { try (var zf = new java.util.zip.ZipFile(p.toFile())) { return zf.size() > 0; } catch (Exception e) { return false; } } Try / catch
try { app.start(); } catch (RuntimeException e) { if (e.getMessage() != null && e.getMessage().startsWith("Failed to read all data for ")) { log.error("Corrupt zip entry — replace jar", e); throw new IllegalStateException("Redeploy verified jar", e); } throw e; } Prevention
- Verify checksums of artifacts after every transfer.
- Use unzip -t in deployment smoke tests.
- Never modify jars in place while the app runs.
- Watch for disk errors on hosts (dmesg).
When it happens
Trigger: getResourceData's stream-loading apply loop reads (int) entry.getSize() bytes from an entry input stream and hits EOF early — the jar's central directory sizes don't match the compressed data (corruption/truncation).
Common situations: Jar corrupted in transit (partial download/upload), jar modified in place while running, broken caching layer serving stale sizes, or disk errors.
Related errors
- Unable to read entry: ${fileEntry.getName()} from jar: ${jar
- Unable to read entry: ${configFileName} from jar: ${jarFile}
- Failed to read zip entry ${res}
- Failed to process
- Failed to read
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/1b9c6413a2b18dcb.
Report an issue: GitHub.