{"record":{"id":"d73d1c761b5c7baa","repo":"quarkusio/quarkus","slug":"the-following-classes-were-not-part-of-the-index-a","errorCode":null,"errorMessage":"The following classes were not part of the index and could be the reason that the captured generic type of '' could not be determined: ","messagePattern":"The following classes were not part of the index and could be the reason that the captured generic type of '' could not be determined: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/util/JandexUtil.java","lineNumber":89,"sourceCode":"        final ClassInfo inputClassInfo;\n        try {\n            inputClassInfo = fetchFromIndex(input, index);\n        } catch (Exception e) {\n            // keep compatibility with what clients already expect\n            throw new IllegalArgumentException(\"Couldn't fetch '\" + input.toString() + \"' class from index\", e);\n        }\n\n        Type startingType = getType(inputClassInfo, index);\n        Set<DotName> unindexedClasses = new LinkedHashSet<>();\n        final List<Type> result = findParametersRecursively(startingType, target,\n                new HashSet<>(), index, unindexedClasses);\n        // null means not found\n        if (result == null) {\n            if (unindexedClasses.isEmpty()) {\n                // no un-indexed classes means that there were no problems traversing the class and interface hierarchies\n                return Collections.emptyList();\n            }\n            throw new IllegalArgumentException(\n                    \"The following classes were not part of the index and could be the reason that the captured generic type of '\"\n                            + target + \"' could not be determined: \" + unindexedClasses);\n        }\n\n        return result;\n    }\n\n    /**\n     * Creates a type for a ClassInfo\n     */\n    private static Type getType(ClassInfo inputClassInfo, IndexView index) {\n        List<TypeVariable> typeParameters = inputClassInfo.typeParameters();\n        if (typeParameters.isEmpty())\n            return ClassType.create(inputClassInfo.name(), Kind.CLASS);\n        Type owner = null;\n        // ignore owners for non-static classes\n        if (inputClassInfo.enclosingClass() != null && !Modifier.isStatic(inputClassInfo.flags())) {\n            owner = getType(fetchFromIndex(inputClassInfo.enclosingClass(), index), index);","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/util/JandexUtil.java#L71-L107","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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)","Upgrade/fix the library dependency so the base classes are present in the application index","Restructure so the concrete class directly parametrizes the target interface, or resolve the type from user configuration instead","Catch IllegalArgumentException and fall back to reflection (getGenericSuperclass) when the index approach is not viable"],"exampleFix":"// before\n@BuildStep\nvoid index(CombinedIndexBuildItem idx) { /* only app classes */ }\n// after\n@BuildStep\nvoid index(CombinedIndexBuildItem idx, AdditionalClassesIndexBuildItem.Builder add) {\n    add.accept(com.thirdparty.BaseRepository.class); // ensure hierarchy is indexed\n}","handlingStrategy":"validation","validationCode":"static boolean hierarchyFullyIndexed(IndexView index, DotName start) {\n    DotName cur = start;\n    while (cur != null && !cur.equals(JandexUtil.DOTNAME_OBJECT)) {\n        ClassInfo ci = index.getClassByName(cur);\n        if (ci == null) return false;\n        cur = ci.superName();\n    }\n    return true;\n}\n","typeGuard":null,"tryCatchPattern":"try {\n    return JandexUtil.resolveTypeParameters(input, target, index);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"The following classes were not part of the index\")) {\n        log.warn(e.getMessage()); // message names the unindexed classes to add\n        return Collections.emptyList();\n    }\n    throw e;\n}\n","preventionTips":["Index all jars containing intermediate superclasses/interfaces named in the error message","Prefer CombinedIndexBuildItem / full application index over hand-built partial indexes","When extending generic framework classes in a library, ship the library's own index (META-INF/jandex.idx) and ensure the aggregator consumes it"],"tags":["jandex","index","generics","class-hierarchy"],"backgroundTag":"class-not-in-jandex-index","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}