quarkusio/quarkus · error · IllegalStateException

Failed to index: ${className}, class not present in class lo

Error message

Failed to index: ${className}, class not present in class loader: ${classLoader}

What it means

During LazyIndexer.complete(), classes recorded earlier are now actually indexed. If a class is absent from the existing index, Quarkus tries to read its bytes from the given class loader; when that yields no stream at all it throws this IllegalStateException naming both the class and the class loader. It means a class was promised to the indexer but cannot be found anywhere.

Source

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

            Collections.sort(current);

            for (String className : current) {
                if (alreadySeen.contains(className)) {
                    continue;
                }

                byte[] classData = classesData.get(className);

                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();

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add the dependency that actually contains the named class to the deployment/runtime classpath
  2. Verify the class name is a binary name (dots, not slashes) and that the class file exists at the expected resource path in its jar
  3. Check that the class loader handed to the indexer includes the application classes (Quarkus augmentation class loader)
  4. If the class is build-time generated, ensure it is generated before the indexing step runs

Example fix

// before
<dependency>
  <groupId>com.acme</groupId><artifactId>acme-optional-model</artifactId>
  <optional>true</optional>
</dependency>
// after
<dependency>
  <groupId>com.acme</groupId><artifactId>acme-optional-model</artifactId>
  <optional>false</optional>
</dependency>
Defensive patterns

Strategy: validation

Validate before calling

// Verify the class is resolvable before indexing
String resource = className.replace('.', '/') + ".class";
boolean present = classLoader.getResource(resource) != null;
if (!present) {
    throw new IllegalStateException("Class " + className + " not found in " + classLoader);
}

Try / catch

try {
    IndexingUtil.indexClass(className, indexer, quarkusIndex, additionalIndex, knownMissingClasses, classLoader);
} catch (IllegalStateException e) {
    if (e.getMessage().contains("class not present in class loader")) {
        log.warnf("Dropping index request for %s: dependency missing from augmentation classpath", className);
        return;
    }
    throw e;
}

Prevention

When it happens

Trigger: A class name was added to the LazyIndexer during bytecode processing, but at complete() time the class is neither in the existing index nor loadable via IoUtil.readClass(classLoader, className) — the resource bytes are simply not there.

Common situations: Class comes from an optional/conditional dependency that is not on the augmentation classpath; a class generated at build time was removed or renamed; class name uses wrong form (internal vs binary) so the resource lookup misses; wrong class loader passed to the indexer.

Related errors


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