junit-team/junit5 · error · UncheckedIOException

Failed to create file system for %s

Error message

Failed to create file system for %s

What it means

UncheckedIOException thrown by CloseablePath.ManagedFileSystem when the configured FileSystemProvider.newFileSystem(jarUri) raises IOException while opening a jar filesystem. The jarUri and the original IOException are preserved. This happens during classpath scanning of jar entries (jar:...!/ URIs or file:.../*.jar paths).

Source

Thrown at junit-platform-commons/src/main/java/org/junit/platform/commons/util/CloseablePath.java:109

	public void close() throws IOException {
		if (closed.compareAndSet(false, true)) {
			delegate.close();
		}
	}

	private static class ManagedFileSystem {

		private final AtomicInteger referenceCount = new AtomicInteger(1);
		private final FileSystem fileSystem;
		private final URI jarUri;

		ManagedFileSystem(URI jarUri, FileSystemProvider fileSystemProvider) {
			this.jarUri = jarUri;
			try {
				fileSystem = fileSystemProvider.newFileSystem(jarUri);
			}
			catch (IOException e) {
				throw new UncheckedIOException("Failed to create file system for " + jarUri, e);
			}
		}

		private ManagedFileSystem retain() {
			referenceCount.incrementAndGet();
			return this;
		}

		private @Nullable ManagedFileSystem release() {
			if (referenceCount.decrementAndGet() == 0) {
				close();
				return null;
			}
			return this;
		}

		private void close() {
			try {

View on GitHub (pinned to f070c699a0)

Solutions

  1. Verify the reported jarUri is a valid zip: run `jar tf <file>` or `unzip -l <file>`
  2. Re-download or rebuild the corrupt jar
  3. Check filesystem permissions on the jar and its parent directories
  4. Remove non-jar files with .jar extension from the classpath
Defensive patterns

Strategy: try-catch

Try / catch

try {
    // classpath scanning that opens jar filesystems
} catch (UncheckedIOException e) {
    IOException cause = e.getCause();
    // inspect cause, repair the classpath / jar
}

Prevention

When it happens

Trigger: Scanning a jar URI (jar:file:/x.jar!/) where FileSystems.newFileSystem throws IOException - corrupt or truncated jar, unsupported env, missing permissions, or a path that ends in .jar but is not a valid zip.

Common situations: Corrupt or truncated JAR on the test classpath; scanning a jar over an unreliable network mount; permission-denied on the jar file; a non-jar file masquerading with a .jar extension.

Related errors


AI-assisted analysis of junit-team/junit5@f070c699a0 (2026-08-11). Data as JSON: /api/errors/f469672e65fbf217. Report an issue: GitHub.