{"record":{"id":"2e40532767d4406d","repo":"quarkusio/quarkus","slug":"couldn-t-fetch-class-from-index","errorCode":null,"errorMessage":"Couldn't fetch '' class from index","messagePattern":"Couldn't fetch '' class from index","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/util/JandexUtil.java","lineNumber":76,"sourceCode":"     *\n     * If we call\n     *\n     * <pre>\n     *\n     * JandexUtil.resolveTypeParameters(DotName.createSimple(MyList.class.getName()),\n     *         DotName.createSimple(List.class.getName()), index)\n     *\n     * </pre>\n     *\n     * then the result will contain a single element of class ClassType whose name() would return a DotName for String\n     */\n    public static List<Type> resolveTypeParameters(DotName input, DotName target, IndexView index) {\n        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;","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/util/JandexUtil.java#L58-L94","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nList<Type> params = JandexUtil.resolveTypeParameters(input, target, partialIndex);\n// after\nif (partialIndex.getClassByName(input) == null) {\n    input = additionalIndex.getClassByName(input); // or throw a clear build error\n}\nList<Type> params = JandexUtil.resolveTypeParameters(input, target, index);","handlingStrategy":"validation","validationCode":"if (index.getClassByName(input) == null) {\n    throw new IllegalStateException(input + \" is not indexed; add it via AdditionalClassesIndexBuildItem\");\n}\nList<Type> params = JandexUtil.resolveTypeParameters(input, target, index);\n","typeGuard":null,"tryCatchPattern":"try {\n    return JandexUtil.resolveTypeParameters(input, target, index);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Couldn't fetch\")) {\n        log.warn(\"Class not in index: \" + input);\n        return Collections.emptyList(); // or re-index\n    }\n    throw e;\n}\n","preventionTips":["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"],"tags":["jandex","index","generics","deployment"],"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-14T00:17:10.932Z"}