{"record":{"id":"2ea4941e251ec0a7","repo":"quarkusio/quarkus","slug":"unable-to-read","errorCode":null,"errorMessage":"Unable to read ","messagePattern":"Unable to read ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/PathTreeClassPathElement.java","lineNumber":325,"sourceCode":"                                lock.readLock().lock();\n                            }\n                        }\n                    } catch (IOException e) {\n                        if (pathTree.isOpen()) {\n                            //this is a weird corner case, that should not really affect end users, but is super annoying\n                            //if you are actually working on Quarkus. If you rebuild quarkus while you have an application\n                            //running reading from the rebuilt zip file will fail, but some of these classes are needed\n                            //for a clean shutdown, so the Java process hangs and needs to be forcibly killed\n                            //this effectively attempts to reopen the file, allowing shutdown to work.\n                            //we need to do this here as close needs a write lock while withJarFile takes a readLock\n                            log.error(\"Failed to read \" + name\n                                    + \" attempting to re-open the zip file. It is likely a jar file changed on disk, you should shutdown your application\",\n                                    e);\n                            lock.readLock().unlock();\n                            try {\n                                close();\n                            } catch (IOException ignore) {\n                                throw new RuntimeException(\"Unable to read \" + name, e.getCause());\n                            } finally {\n                                lock.readLock().lock();\n                            }\n                        } else {\n                            throw new RuntimeException(\"Unable to read \" + name, e);\n                        }\n                    }\n                }\n                // reading the entry directly from the JAR\n                final boolean interrupted = Thread.interrupted();\n                try {\n                    return pathTree.getOriginalTree().apply(name, visit -> {\n                        if (visit == null) {\n                            return null;\n                        }\n                        try {\n                            return Files.readAllBytes(visit.getPath());\n                        } catch (IOException e) {","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/PathTreeClassPathElement.java#L307-L343","documentation":"Thrown by PathTreeClassPathElement.getData() when the bytes of a classpath resource cannot be read from its containing JAR. The library wraps the underlying IOException (e.g. ZipException) in a RuntimeException, either after attempting to re-open a jar whose file handle went stale, or directly when reading fails.","triggerScenarios":"Calling getData() on a classpath element backed by a jar file that was modified, replaced, or deleted on disk while the classloader held it open (the code detects a changed jar, tries close() + re-open, and gives up if that still fails), or an IOException reading the zip entry.","commonSituations":"Rebuilding/redeploying a jar while a dev-mode or test application is still running; Maven/Gradle overwriting the jar during a build; file-sync in a container or NFS causing the jar inode to change; corrupted or partially-written jar files.","solutions":["Stop the running application, rebuild, and start it again so the classloader picks up the fresh jar","Identify which process or build step is rewriting the jar while the app runs and serialize them (e.g. don't run 'mvn install' on a jar used by a live dev-mode app)","If the error persists on a stable jar, verify the jar's integrity (jar tf / unzip -t) and rebuild it","Restart dev-mode if an external build (e.g. IDE) touched target/ jars mid-run"],"exampleFix":"// before (external process overwrote jar while app runs)\nmvn install &\n./mvnw quarkus:dev  # reads jar concurrently -> Unable to read\n// after\n./mvnw install\n./mvnw quarkus:dev  # build finishes before dev mode starts","handlingStrategy":"retry","validationCode":"Path jar = Paths.get(jarPath);\nif (!Files.isRegularFile(jar) || !Files.isReadable(jar)) {\n    throw new IllegalStateException(\"Jar missing/unreadable: \" + jar);\n}\ntry (var zf = new java.util.zip.ZipFile(jar.toFile())) {\n    if (zf.getEntry(resourceName) == null) throw new IllegalStateException(\"Entry missing: \" + resourceName);\n}","typeGuard":null,"tryCatchPattern":"try {\n    byte[] data = element.getData(resourceName);\n} catch (RuntimeException e) {\n    // message starts with \"Unable to read \" — jar likely changed on disk\n    // restart the application / recreate the classloader, do not retry in-place\n}","preventionTips":["Never rebuild or overwrite jars that a running Quarkus dev-mode/test process has open","Run external builds before starting dev mode, not concurrently","Use a stable filesystem for classpath jars (avoid NFS/container bind-mount churn for target/)"],"tags":["classloading","jar","ioexception","devmode"],"backgroundTag":"jar-modified-while-open","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}