{"record":{"id":"31ad99c5c70dd46b","repo":"quarkusio/quarkus","slug":"injected-class-not-found-in-index","errorCode":null,"errorMessage":"Injected class not found in index: ","messagePattern":"Injected class not found in index: ","errorType":"error_code","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/CachedResultsProcessor.java","lineNumber":352,"sourceCode":"\n        AnnotationValue excludeValue = annotation.value(\"exclude\");\n        if (excludeValue != null)\n            exclude = excludeValue.asString();\n\n        if (annotation.target().kind() == Kind.FIELD) {\n            type = annotation.target().asField().type();\n        } else if (annotation.target().kind() == Kind.METHOD_PARAMETER) {\n            type = annotation.target().asMethodParameter().type();\n        } else {\n            throw new IllegalStateException(\"Unsupported target:\" + annotation.target());\n        }\n\n        if (type.kind() != Type.Kind.CLASS) {\n            throw new IllegalStateException(\"Invalid type: \" + type);\n        }\n        ClassInfo injectedClazz = index.getClassByName(type.name());\n        if (injectedClazz == null) {\n            throw new IllegalStateException(\"Injected class not found in index: \" + type.name());\n        }\n        if (!injectedClazz.isInterface()\n                && !injectedClazz.hasNoArgsConstructor()) {\n            throw new IllegalStateException(\n                    \"@CachedResults class must be an interface or declare a no-args constructor: \" + injectedClazz);\n        }\n        return new CachedResultsInjectConfig(cacheName, lockTimeout, keyGenerator, injectedClazz,\n                // consider all but @CachedResults and @Inject\n                annotation.target().declaredAnnotations().stream().filter(\n                        a -> !a.name().equals(CACHED_RESULTS)\n                                && !a.name().equals(INJECT))\n                        .toList(),\n                exclude);\n    }\n\n    record CachedResultsInjectConfig(String cacheName, Long lockTimeout, DotName keyGenerator, ClassInfo injectedClazz,\n            Collection<AnnotationInstance> annotations, String exclude) {\n","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/CachedResultsProcessor.java#L334-L370","documentation":"The type of the @CachedResults injection point is not present in the deployment Jandex index. The build step must inspect the class (interface check, constructor check), so an unindexed type — typically from an external jar not indexed by Quarkus — fails the build.","triggerScenarios":"Injecting a type that lives in a dependency jar excluded from the application index (Jandex index), e.g. a class from a non-Quarkus library, or referencing a class produced outside the indexed sources.","commonSituations":"Third-party interfaces not annotated with @Indexable or shipped in jars without META-INF/jandex.idx; generated classes not visible to the deployment index; typos causing resolution of a non-existent class.","solutions":["Add a META-INF/jandex.idx to the library jar, or depend on its `-jandex` classifier artifact if offered.","If you control the jar, run the Jandex maven/gradle plugin on it.","Ensure the class is actually on the application classpath and spelled correctly.","For generated classes, make sure generation happens in a Quarkus-visible source root or via a build step that registers them in the index."],"exampleFix":"<!-- before: external jar with no index -->\n<dependency>\n  <groupId>com.example</groupId>\n  <artifactId>my-api</artifactId>\n</dependency>\n\n<!-- after -->\n<dependency>\n  <groupId>com.example</groupId>\n  <artifactId>my-api</artifactId>\n  <classifier>jandex</classifier>\n</dependency>","handlingStrategy":"validation","validationCode":"// Check the type is on the classpath and indexed\nClass<?> clazz = Class.forName(\"com.example.MyApi\");\n// If from a library, verify a jandex.idx exists:\n// unzip -l my-api.jar | grep 'META-INF/jandex.idx'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer libraries that ship jandex indexes or use their -jandex classifier","Keep cached interfaces in your own application sources when possible","Confirm dependencies with a full ./mvnw build, not just IDE compilation"],"tags":["quarkus","cache","build-time","jandex","classpath"],"backgroundTag":"class-not-in-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"}