quarkusio/quarkus · error · IllegalArgumentException
Couldn't fetch '' class from index
Error message
Couldn't fetch '' class from index
What it means
JandexUtil.resolveTypeParameters walks the class/interface hierarchy in a Jandex index to find the captured generic arguments of a target type. If the input class itself cannot be found in the supplied IndexView, fetchFromIndex throws ClassNotIndexedException which is rethrown as IllegalArgumentException("Couldn't fetch '<name>' class from index"). The index must contain every class on the path to the target.
Source
Thrown at core/deployment/src/main/java/io/quarkus/deployment/util/JandexUtil.java:76
*
* If we call
*
* <pre>
*
* JandexUtil.resolveTypeParameters(DotName.createSimple(MyList.class.getName()),
* DotName.createSimple(List.class.getName()), index)
*
* </pre>
*
* then the result will contain a single element of class ClassType whose name() would return a DotName for String
*/
public static List<Type> resolveTypeParameters(DotName input, DotName target, IndexView index) {
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;View on GitHub (pinned to e1c734241f)
Solutions
- Ensure the class is added to the index: for build steps, augment the index via AdditionalClassesIndexBuildItem or register-for-index patterns
- Verify the exact binary name (FQCN, not Class.getName() of array/inner with $ mismatches) used for the DotName
- Check that the index you pass is the full application index (CuratedApplication/index) not a partial one
- If the class may legitimately be absent, guard with index.getClassByName(input) == null before calling
Example fix
// before
List<Type> params = JandexUtil.resolveTypeParameters(input, target, partialIndex);
// after
if (partialIndex.getClassByName(input) == null) {
input = additionalIndex.getClassByName(input); // or throw a clear build error
}
List<Type> params = JandexUtil.resolveTypeParameters(input, target, index); Defensive patterns
Strategy: validation
Validate before calling
if (index.getClassByName(input) == null) {
throw new IllegalStateException(input + " is not indexed; add it via AdditionalClassesIndexBuildItem");
}
List<Type> params = JandexUtil.resolveTypeParameters(input, target, index);
Try / catch
try {
return JandexUtil.resolveTypeParameters(input, target, index);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Couldn't fetch")) {
log.warn("Class not in index: " + input);
return Collections.emptyList(); // or re-index
}
throw e;
}
Prevention
- Check index.getClassByName(dotName) before resolving type parameters
- Index third-party base classes your hierarchy depends on (AdditionalClassesIndexBuildItem)
- Build DotNames from indexed ClassInfo, not hand-typed strings, to avoid name mismatches
When it happens
Trigger: Calling JandexUtil.resolveTypeParameters(input, target, index) where input's DotName is not in the IndexView — e.g. using a limited application index that excludes the class, a generated class not indexed yet, or a fully qualified name that doesn't match the indexed binary name.
Common situations: Build steps computing generic bindings (e.g. resolving Entity/repository type parameters) for classes from external jars not included in the Jandex index; typos in class names built with DotName.createSimple; indexes built with too-narrow package filters.
Related errors
- The following classes were not part of the index and could b
- Our supertype instance does not match supertype declared ar
- Unsupported type: " + type
- Missing type argument mapping for
- Illegal type in hierarchy:
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/2e40532767d4406d.
Report an issue: GitHub.