junit-team/junit5 · warning · UncheckedIOException
Failed to close file system for
Error message
Failed to close file system for ${jarUri} What it means
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).
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
Defensive patterns
Strategy: try-catch
Try / catch
try {
closeablePath.close();
} catch (UncheckedIOException e) {
// log; usually safe to continue at teardown - the FS is being torn down anyway
} Prevention
- 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
When it happens
Trigger: Closing a jar FileSystem whose underlying file handle is already closed, concurrently closed, or otherwise unavailable; OS-level resource exhaustion at teardown.
Common situations: 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.
Related errors
- Failed to create file system for
- Failed to read contents of
- Error redirecting stderr to file
- Error redirecting stdout and stderr to file
- Error redirecting stdout to file
AI-assisted analysis of junit-team/junit5@f070c699a0 (2026-08-11).
Data as JSON: /api/errors/e7b8ba7786965dae.
Report an issue: GitHub.
Appendix: source
Thrown at junit-platform-commons/src/main/java/org/junit/platform/commons/util/CloseablePath.java:131
private ManagedFileSystem retain() {
referenceCount.incrementAndGet();
return this;
}
private @Nullable ManagedFileSystem release() {
if (referenceCount.decrementAndGet() == 0) {
close();
return null;
}
return this;
}
private void close() {
try {
fileSystem.close();
}
catch (IOException e) {
throw new UncheckedIOException("Failed to close file system for " + jarUri, e);
}
}
}
interface FileSystemProvider {
FileSystem newFileSystem(URI uri) throws IOException;
}
}
View on GitHub (pinned to f070c699a0)