quarkusio/quarkus · error · UncheckedIOException

Can't read Jandex index from ${tree}

Error message

Can't read Jandex index from ${tree}

What it means

IndexingUtil's archive indexer attempts to read a pre-built Jandex index (META-INF/jandex.idx) from a JAR; an IOException reading it is thrown as UncheckedIOException "Can't read Jandex index from <tree>". Quarkus consumes index files produced by the jandex-maven-plugin to speed up augmentation; a broken read aborts indexing of that archive.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/index/IndexingUtil.java:77

                    try (InputStream in = Files.newInputStream(visit.getPath())) {
                        IndexReader reader = new IndexReader(in);
                        try {
                            int indexVersion = reader.getIndexVersion();
                            if (indexVersion < REQUIRED_INDEX_VERSION) {
                                log.warnf("Reindexing %s, at least Jandex 3.0 must be used"
                                        + " to index an application dependency (index version is %s)",
                                        tree.toString(), indexVersion);
                                return null;
                            }
                            return reader.read();
                        } catch (UnsupportedVersion e) {
                            log.warnf("Reindexing %s, the index format is too new for the Jandex version"
                                    + " used by your application. Please report it to the author of this JAR (%s)",
                                    tree.toString(), e.getMessage());
                            return null;
                        }
                    } catch (IOException e) {
                        throw new UncheckedIOException("Can't read Jandex index from " + tree, e);
                    }
                }
            });
            if (index != null) {
                return index;
            }
        }

        List<Path> classFilesToIndex = new ArrayList<>();
        tree.walk(new PathVisitor() {
            @Override
            public void visitPath(PathVisit visit) {
                Path fileName = visit.getPath().getFileName();
                if (fileName == null
                        || !fileName.toString().endsWith(".class")
                        || Files.isDirectory(visit.getPath())
                        || removed != null && removed.contains(visit.getRelativePath("/"))) {
                    return;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Rebuild the offending library with a current jandex-maven-plugin (or remove the plugin to let Quarkus index normally)
  2. Delete and re-download the corrupt JAR from the local repository
  3. Check the JAR contents: unzip -l lib.jar META-INF/jandex.idx; regenerate if missing/broken
  4. Upgrade Quarkus/Jandex if the index format is newer than the runtime Jandex (older Jandex warns and reindexes instead)

Example fix

// before: library jar shipped stale/corrupt idx
// after: regenerate index in the library build
mvn org.jboss.jandex:jandex-maven-plugin:jandex -f library-pom.xml
Defensive patterns

Strategy: validation

Validate before calling

try (ZipFile zf = new ZipFile(jar.toFile())) {
    ZipEntry idx = zf.getEntry("META-INF/jandex.idx");
    if (idx != null && idx.getSize() == 0) {
        throw new IllegalStateException("Empty Jandex index in " + jar + " — regenerate with jandex-maven-plugin");
    }
}

Try / catch

try {
    indexArchive(tree);
} catch (UncheckedIOException e) {
    if (e.getMessage().startsWith("Can't read Jandex index from ")) {
        // fall back: strip META-INF/jandex.idx and let Quarkus index the archive itself
    }
    throw e;
}

Prevention

When it happens

Trigger: apply() visiting an archive containing META-INF/jandex.idx where the idx stream cannot be read (corrupt/empty/truncated index, unreadable archive entry).

Common situations: Jandex index produced by an incompatible or buggy jandex-maven-plugin version; truncated JAR from interrupted download; damaged index inside a shaded/processed JAR.

Related errors


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