quarkusio/quarkus · error · java.lang.RuntimeException

Failed to read

Error message

Failed to read 

What it means

SharedArchivePathTree.open() opens the archive filesystem (e.g. zip/jar via openFs()) and wraps any exception in a RuntimeException 'Failed to read <archive>'. It means the jar/zip backing the path tree could not be opened, typically because the file is missing, corrupt, or not a valid archive.

Source

Thrown at independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/SharedArchivePathTree.java:67

    private volatile SharedOpenArchivePathTree lastOpen;

    SharedArchivePathTree(Path archive) {
        super(archive);
    }

    @Override
    public OpenPathTree open() {
        var lastOpen = this.lastOpen;
        if (lastOpen != null) {
            var acquired = lastOpen.acquire();
            if (acquired != null) {
                return acquired;
            }
        }
        try {
            lastOpen = this.lastOpen = new SharedOpenArchivePathTree(openFs());
        } catch (Exception e) {
            throw new RuntimeException("Failed to read " + archive, e);
        }
        return new CallerOpenPathTree(lastOpen);
    }

    private class SharedOpenArchivePathTree extends OpenArchivePathTree {

        private final AtomicInteger users = new AtomicInteger(1);

        protected SharedOpenArchivePathTree(ReadOnlyZipFileSystem fs) {
            super(fs);
            openCount.incrementAndGet();
        }

        /**
         * Returns a new handle for this open archive tree to the caller
         * as long as this open archive tree is still open and is still
         * the last one that was open for this archive. Otherwise, the method
         * will return null.

View on GitHub (pinned to e1c734241f)

Solutions

  1. Verify the archive exists and is a valid zip: unzip -t archive.jar; re-download/rebuild it (mvn -U, mvn clean install)
  2. Check file read permissions and that no other process holds it locked
  3. Rebuild the application so the jar is regenerated
  4. Look at the cause (e) for the precise zip error

Example fix

// before
mvn package
// after
mvn clean package -U   # rebuild and force re-download of possibly corrupt deps
Defensive patterns

Strategy: validation

Validate before calling

Path jar = Path.of(archive);
if (!Files.isRegularFile(jar) || !Files.isReadable(jar)) throw new IllegalStateException("Missing archive: " + jar);
try (ZipFile zf = new ZipFile(jar.toFile())) { } catch (IOException e) { throw new IllegalStateException("Corrupt archive: " + jar, e); }

Type guard

boolean isOpenableArchive(Path p) { try { return Files.isRegularFile(p) && new ZipFile(p.toFile()).size() > 0; } catch (IOException e) { return false; } }

Try / catch

try { tree = sharedTree.open(); } catch (RuntimeException e) { log.error("Archive unreadable: " + e.getCause()); rebuildOrReDownloadArchive(); }

Prevention

When it happens

Trigger: Calling open() on a SharedArchivePathTree for an archive whose file does not exist, is corrupt/truncated, lacks read permission, or is a multi-release/zip structure the FS provider rejects.

Common situations: Corrupted jar in local Maven repo after interrupted download; partially-written application jar during hot deployment; classpath entry pointing at a deleted or locked file (Windows file locking).

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/e8c8f0e582f508dd. Report an issue: GitHub.