{"record":{"id":"e7b8ba7786965dae","repo":"junit-team/junit5","slug":"failed-to-close-file-system-for-jaruri","errorCode":null,"errorMessage":"Failed to close file system for ${jarUri}","messagePattern":"Failed to close file system for (.+?)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"warning","filePath":"junit-platform-commons/src/main/java/org/junit/platform/commons/util/CloseablePath.java","lineNumber":131,"sourceCode":"\t\tprivate ManagedFileSystem retain() {\n\t\t\treferenceCount.incrementAndGet();\n\t\t\treturn this;\n\t\t}\n\n\t\tprivate @Nullable ManagedFileSystem release() {\n\t\t\tif (referenceCount.decrementAndGet() == 0) {\n\t\t\t\tclose();\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\n\t\tprivate void close() {\n\t\t\ttry {\n\t\t\t\tfileSystem.close();\n\t\t\t}\n\t\t\tcatch (IOException e) {\n\t\t\t\tthrow new UncheckedIOException(\"Failed to close file system for \" + jarUri, e);\n\t\t\t}\n\t\t}\n\t}\n\n\tinterface FileSystemProvider {\n\t\tFileSystem newFileSystem(URI uri) throws IOException;\n\t}\n}\n","sourceCodeStart":113,"sourceCodeEnd":140,"githubUrl":"https://github.com/junit-team/junit5/blob/f070c699a08b5d8393df9afd147af5c5e90bb21b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/CloseablePath.java#L113-L140","documentation":"UncheckedIOException thrown by CloseablePath.ManagedFileSystem.close() when FileSystem.close() fails during teardown of a managed jar filesystem (the reference count dropped to zero). The jarUri and the original IOException are attached. This is a resource-release-time failure, distinct from open-time failure (error 89).","triggerScenarios":"Closing a jar FileSystem whose underlying file handle is already closed, concurrently closed, or otherwise unavailable; OS-level resource exhaustion at teardown.","commonSituations":"Concurrent test execution racing on the same jar filesystem; nested CloseablePath usage closing the FS prematurely; file-handle leaks exhausting the OS limit; antivirus or build-tool locking on Windows.","solutions":["Audit code for manual FileSystem.close() calls on jars that JUnit manages","Reduce parallel test fan-out that touches the same jar","Raise OS file-handle limits (ulimit -n) if exhaustion is the cause","Ensure antivirus/build tooling is not locking the jar"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    closeablePath.close();\n} catch (UncheckedIOException e) {\n    // log; usually safe to continue at teardown - the FS is being torn down anyway\n}","preventionTips":["Let JUnit own the lifecycle of jar FileSystems it opens - do not close them manually","Avoid mixing manual FileSystem management with JUnit scanning","Monitor file-handle usage under parallel test loads"],"tags":["classpath-scanning","jar","io","resource-management"],"backgroundTag":null,"analyzedSha":"f070c699a08b5d8393df9afd147af5c5e90bb21b","analyzedAt":"2026-08-11T20:31:00.530Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}