{"record":{"id":"a71ba3d639b4cac8","repo":"quarkusio/quarkus","slug":"failed-to-read-zip-entry-res","errorCode":null,"errorMessage":"Failed to read zip entry ${res}","messagePattern":"Failed to read zip entry (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/JarResource.java","lineNumber":91,"sourceCode":"            ZipEntry entry = jarFile.getEntry(res);\n            if (entry == null) {\n                return null;\n            }\n            try (InputStream is = jarFile.getInputStream(entry)) {\n                byte[] data = new byte[(int) entry.getSize()];\n                int pos = 0;\n                int rem = data.length;\n                while (rem > 0) {\n                    int read = is.read(data, pos, rem);\n                    if (read == -1) {\n                        throw new RuntimeException(\"Failed to read all data for \" + res);\n                    }\n                    pos += read;\n                    rem -= read;\n                }\n                return data;\n            } catch (IOException e) {\n                throw new RuntimeException(\"Failed to read zip entry \" + res, e);\n            }\n        }\n    }\n\n    @Override\n    public URL getResourceURL(String resource) {\n        return JarFileReference.withJarFile(this, resource, JarResourceURLProvider.INSTANCE);\n    }\n\n    private static class JarResourceURLProvider implements JarFileReference.JarFileConsumer<URL> {\n        private static final JarResourceURLProvider INSTANCE = new JarResourceURLProvider();\n\n        @Override\n        public URL apply(JarFile jarFile, Path path, String resource) {\n            JarEntry entry = jarFile.getJarEntry(resource);\n            if (entry == null) {\n                return null;\n            }","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/JarResource.java#L73-L109","documentation":"Wraps an IOException thrown while opening or reading a jar entry's stream in getResourceData — the zip entry could not be read at all (unlike 3146, which is a short read). Typically a corrupt zip structure, CRC error, or the jar file becoming unreadable mid-read.","triggerScenarios":"apply calls jarFile.getInputStream(entry) / reads it and any IOException occurs: invalid entry reference, CRC mismatch, IO error on the underlying file during read.","commonSituations":"Jar damaged by an interrupted transfer or disk fault; jar deleted/replaced while the classloader still has it open; filesystem errors on the host (full disk, failing mount).","solutions":["Run unzip -t on the jar to confirm corruption and rebuild/redeploy it.","Restart the application after a clean redeploy so the classloader reopens valid jars.","Check host disk health and free space; review dmesg/filesystem logs for IO errors.","Ensure deploys use atomic replacement (copy to temp + rename) rather than in-place overwrite."],"exampleFix":"// before\ncp new.jar /deploy/lib/app.jar  # while app runs\n// after\ncp new.jar /deploy/lib/.app.jar.tmp && mv /deploy/lib/.app.jar.tmp /deploy/lib/app.jar  # restart app after","handlingStrategy":"try-catch","validationCode":"try (var zf = new java.util.zip.ZipFile(jar.toFile())) { var e = zf.entries(); while (e.hasMoreElements()) zf.getInputStream(e.nextElement()); return true; } catch (IOException ex) { return false; }","typeGuard":"boolean isHealthyJar(Path p) { try (var zf = new java.util.zip.ZipFile(p.toFile())) { return true; } catch (IOException e) { return false; } }","tryCatchPattern":"try { app.start(); } catch (RuntimeException e) { if (e.getMessage() != null && e.getMessage().startsWith(\"Failed to read zip entry\")) { log.error(\"Jar IO failure: {}\", e.getMessage(), e.getCause()); throw new IllegalStateException(\"Corrupt jar or filesystem issue — redeploy\", e); } throw e; }","preventionTips":["Deploy jars atomically (temp file + rename).","Run disk health checks on hosts with recurring IO failures.","Ensure the app is stopped before replacing its jars.","Keep sufficient free disk space."],"tags":["jar","corruption","io"],"backgroundTag":"corrupt-jar-file","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"}