quarkusio/quarkus · error · IllegalStateException

Failed to index: ${className}

Error message

Failed to index: ${className}

What it means

LazyIndexer.complete() indexes each pending class; any Exception thrown by Javassist indexWithSummary (malformed bytecode, unsupported class file version, IO problems) is wrapped as this IllegalStateException. Unlike [94], the bytes were found but could not be parsed.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/index/LazyIndexer.java:155

                DotName superclassName;
                Set<DotName> annotationNames;

                ClassInfo classInfo = existingIndex.getClassByName(className);
                if (classInfo == null) {
                    try (InputStream stream = classData != null
                            ? new ByteArrayInputStream(classData)
                            : IoUtil.readClass(classLoader, className)) {
                        if (stream == null) {
                            throw new IllegalStateException("Failed to index: " + className
                                    + ", class not present in class loader: " + classLoader);
                        }

                        ClassSummary summary = indexer.indexWithSummary(stream);
                        alreadySeen.add(summary.name().toString());
                        superclassName = summary.superclassName();
                        annotationNames = summary.annotations();
                    } catch (Exception e) {
                        throw new IllegalStateException("Failed to index: " + className, e);
                    }
                } else {
                    alreadySeen.add(className);
                    superclassName = classInfo.superName();
                    annotationNames = classInfo.annotationsMap().keySet();
                }

                for (DotName annotationDotName : annotationNames) {
                    String annotationName = annotationDotName.toString();
                    if (!alreadySeen.contains(annotationName) && existingIndex.getClassByName(annotationDotName) == null) {
                        try (InputStream annotationStream = IoUtil.readClass(classLoader, annotationName)) {
                            if (annotationStream == null) {
                                missingAnnotations.add(annotationDotName);
                            } else {
                                next.add(annotationName);
                            }
                        } catch (IOException e) {
                            throw new IllegalStateException("Failed to index: " + className, e);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Run the build on a JDK at least as new as the class file version of the failing class
  2. Re-download the containing jar (delete from ~/.m2 and rebuild) to fix corruption
  3. Disable bytecode transformation plugins/agents for that dependency and rebuild
  4. Update Quarkus, which may bundle a newer Javassist supporting the bytecode version

Example fix

// before
JAVA_HOME=$(jdk8-home) ./mvnw install   # lib compiled with class file v61
// after
JAVA_HOME=$(jdk17-home) ./mvnw install
Defensive patterns

Strategy: try-catch

Validate before calling

// Check the class file version is readable by the build JVM
int major = (data[6] & 0xff) << 8 | (data[7] & 0xff);
int maxSupported = Runtime.version().feature() + 44; // approx class file major for this JDK
if (major > maxSupported) {
    throw new IllegalStateException("Class " + className + " v" + major + " too new for this JDK");
}

Try / catch

try {
    IndexingUtil.indexClass(className, indexer, quarkusIndex, additionalIndex, knownMissingClasses, classLoader);
} catch (IllegalStateException e) {
    log.errorf(e, "Cannot index %s - cause: %s. Check JDK version vs bytecode level and jar integrity",
            className, e.getCause());
    throw e;
}

Prevention

When it happens

Trigger: The class bytes were successfully opened from ByteArrayInputStream(classData) or IoUtil.readClass(), but indexer.indexWithSummary(stream) threw while parsing — invalid class file format, ASM/Javassist version too old for the bytecode level, or truncated bytes.

Common situations: Dependency compiled with a newer JDK than the build JVM supports; corrupt jar entries; bytecode weaved/transformed by an agent or Gradle plugin into something Javassist cannot read.

Related errors


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