{"record":{"id":"774ce2e235fd60fc","repo":"quarkusio/quarkus","slug":"java-io-uncheckedioexception","errorCode":null,"errorMessage":"java.io.UncheckedIOException","messagePattern":"java\\.io\\.UncheckedIOException","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/PathTreeClassPathElement.java","lineNumber":143,"sourceCode":"            });\n            return ret;\n        });\n    }\n\n    @Override\n    public <T> T apply(Function<OpenPathTree, T> func) {\n        lock.readLock().lock();\n        try {\n            if (pathTree.isOpen()) {\n                return func.apply(pathTree);\n            }\n            //we still need this to work if it is closed, so shutdown hooks work\n            //once it is closed it simply does not hold on to any resources\n            final boolean interrupted = Thread.interrupted();\n            try (OpenPathTree openTree = pathTree.getOriginalTree().open()) {\n                return func.apply(openTree);\n            } catch (IOException e) {\n                throw new UncheckedIOException(e);\n            } finally {\n                if (interrupted) {\n                    Thread.currentThread().interrupt();\n                }\n            }\n        } finally {\n            lock.readLock().unlock();\n        }\n    }\n\n    @Override\n    public Set<String> getProvidedResources() {\n        return pathTree.getResourceNames();\n    }\n\n    @Override\n    public boolean containsReloadableResources() {\n        return !pathTree.isArchiveOrigin();","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/PathTreeClassPathElement.java#L125-L161","documentation":"PathTreeClassPathElement.apply opens the original PathTree to run a function and wraps any IOException in java.io.UncheckedIOException so it can be thrown from a lambda/supplier context. It signals that reading the backing filesystem tree failed while the element was being accessed. The message carries the wrapped IOException cause.","triggerScenarios":"Calling methods on a PathTreeClassPathElement (via apply) after the underlying zip/file was deleted or moved, or when opening the PathTree throws IOException (I/O error reading the jar/file).","commonSituations":"Running application with jars removed while running (hot redeploys, cleanup scripts deleting target/), filesystem errors, or files locked on Windows.","solutions":["Check the cause IOException for the real problem (missing file vs permission)","Ensure the application jars are not deleted/moved while running","Restore the missing classpath resource or rebuild the application","Retry on transient filesystem errors"],"exampleFix":"// before\nbyte[] data = element.getData(); // UncheckedIOException\n// after\ntry {\n    byte[] data = element.getData();\n} catch (UncheckedIOException e) {\n    LOGGER.error(\"Classpath element unreadable\", e.getCause());\n}","handlingStrategy":"try-catch","validationCode":"if (!Files.exists(pathTreeRoot)) throw new IllegalStateException(\"classpath element missing: \" + pathTreeRoot);","typeGuard":null,"tryCatchPattern":"try {\n    byte[] data = element.getData();\n} catch (UncheckedIOException e) {\n    IOException cause = e.getCause();\n    // log and fall back or abort startup\n}","preventionTips":["Do not delete or modify application jars while the app is running","Check disk health/permissions on the classpath location","Inspect getCause() to distinguish missing-file from other IO failures"],"tags":["classloading","io","filesystem"],"backgroundTag":"unchecked-io-exception","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"}