quarkusio/quarkus · error · IllegalArgumentException

The following classes were not part of the index and could b

Error message

The following classes were not part of the index and could be the reason that the captured generic type of '' could not be determined: 

What it means

When resolveTypeParameters cannot find the target generic declaration (result == null) and encountered classes along the hierarchy that were missing from the index, it throws IllegalArgumentException listing those unindexed classes. Without them the captured generic type of the target cannot be determined, because superclass/interface type arguments cannot be traversed.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/util/JandexUtil.java:89

        final ClassInfo inputClassInfo;
        try {
            inputClassInfo = fetchFromIndex(input, index);
        } catch (Exception e) {
            // keep compatibility with what clients already expect
            throw new IllegalArgumentException("Couldn't fetch '" + input.toString() + "' class from index", e);
        }

        Type startingType = getType(inputClassInfo, index);
        Set<DotName> unindexedClasses = new LinkedHashSet<>();
        final List<Type> result = findParametersRecursively(startingType, target,
                new HashSet<>(), index, unindexedClasses);
        // null means not found
        if (result == null) {
            if (unindexedClasses.isEmpty()) {
                // no un-indexed classes means that there were no problems traversing the class and interface hierarchies
                return Collections.emptyList();
            }
            throw new IllegalArgumentException(
                    "The following classes were not part of the index and could be the reason that the captured generic type of '"
                            + target + "' could not be determined: " + unindexedClasses);
        }

        return result;
    }

    /**
     * Creates a type for a ClassInfo
     */
    private static Type getType(ClassInfo inputClassInfo, IndexView index) {
        List<TypeVariable> typeParameters = inputClassInfo.typeParameters();
        if (typeParameters.isEmpty())
            return ClassType.create(inputClassInfo.name(), Kind.CLASS);
        Type owner = null;
        // ignore owners for non-static classes
        if (inputClassInfo.enclosingClass() != null && !Modifier.isStatic(inputClassInfo.flags())) {
            owner = getType(fetchFromIndex(inputClassInfo.enclosingClass(), index), index);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add the missing classes to the index (list the classes printed in the message and index their containing artifacts, e.g. via AdditionalClassesIndexBuildItem in a build step)
  2. Upgrade/fix the library dependency so the base classes are present in the application index
  3. Restructure so the concrete class directly parametrizes the target interface, or resolve the type from user configuration instead
  4. Catch IllegalArgumentException and fall back to reflection (getGenericSuperclass) when the index approach is not viable

Example fix

// before
@BuildStep
void index(CombinedIndexBuildItem idx) { /* only app classes */ }
// after
@BuildStep
void index(CombinedIndexBuildItem idx, AdditionalClassesIndexBuildItem.Builder add) {
    add.accept(com.thirdparty.BaseRepository.class); // ensure hierarchy is indexed
}
Defensive patterns

Strategy: validation

Validate before calling

static boolean hierarchyFullyIndexed(IndexView index, DotName start) {
    DotName cur = start;
    while (cur != null && !cur.equals(JandexUtil.DOTNAME_OBJECT)) {
        ClassInfo ci = index.getClassByName(cur);
        if (ci == null) return false;
        cur = ci.superName();
    }
    return true;
}

Try / catch

try {
    return JandexUtil.resolveTypeParameters(input, target, index);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("The following classes were not part of the index")) {
        log.warn(e.getMessage()); // message names the unindexed classes to add
        return Collections.emptyList();
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling JandexUtil.resolveTypeParameters(input, target, index) where the input class implements/extends the target through intermediate classes (superclass or interfaces) that are absent from the IndexView — so findParametersRecursively fails partway and records ClassNotIndexedException names.

Common situations: Framework base classes (e.g. a generic Repository<T> base in a third-party jar) not being indexed while the user class is; index built only from application classes; dependency excluded from Jandex indexing.

Related errors


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