{"record":{"id":"3bb0fe0f3fc01612","repo":"quarkusio/quarkus","slug":"failed-to-index-name","errorCode":null,"errorMessage":"Failed to index: ${name}","messagePattern":"Failed to index: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/recording/AnnotationProxyProvider.java","lineNumber":68,"sourceCode":"        if (classLoader == null) {\n            classLoader = AnnotationProxy.class.getClassLoader();\n        }\n        this.classLoader = classLoader;\n    }\n\n    public <A extends Annotation> AnnotationProxyBuilder<A> builder(AnnotationInstance annotationInstance,\n            Class<A> annotationType) {\n        if (!annotationInstance.name().toString().equals(annotationType.getName())) {\n            throw new IllegalArgumentException(\"Annotation instance \" + annotationInstance + \" does not match annotation type \"\n                    + annotationType.getName());\n        }\n        ClassInfo annotationClass = annotationClasses.computeIfAbsent(annotationInstance.name(), name -> {\n            ClassInfo clazz = index.getClassByName(name);\n            if (clazz == null) {\n                try (InputStream annotationStream = IoUtil.readClass(classLoader, name.toString())) {\n                    clazz = Index.singleClass(annotationStream);\n                } catch (Exception e) {\n                    throw new IllegalStateException(\"Failed to index: \" + name, e);\n                }\n            }\n            return clazz;\n        });\n        String annotationLiteral = annotationLiterals.computeIfAbsent(annotationInstance.name(),\n                // com.foo.MyAnnotation -> com.foo.MyAnnotation_Proxy_AnnotationLiteral\n                name -> name + \"_Proxy_AnnotationLiteral\");\n\n        return new AnnotationProxyBuilder<>(annotationInstance, annotationType, annotationLiteral, annotationClass);\n    }\n\n    public interface AnnotationProxy {\n\n        String getAnnotationLiteralType();\n\n        ClassInfo getAnnotationClass();\n\n        AnnotationInstance getAnnotationInstance();","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/recording/AnnotationProxyProvider.java#L50-L86","documentation":"To synthesize an annotation literal, the provider needs the Jandex ClassInfo of the annotation type. If it isn't in the application index, Quarkus tries to read and index the class bytecode from the build classloader; failure to load or index it (corrupt/missing class file, wrong classloader) raises this IllegalStateException with the class name.","triggerScenarios":"builder() is called with an AnnotationInstance whose annotation class is absent from the application index and IoUtil.readClass + Index.singleClass throws — class not on the build classpath, array/primitive edge, or read/parse error.","commonSituations":"Annotation defined in a module not indexed by Quarkus; annotation coming from a JDK/internal package; shading/relocation breaking the class file lookup.","solutions":["Ensure the annotation type is on the build classpath and part of the indexed application classes","Check the 'Caused by' for the real read/index failure (ClassFormatError, IOException, etc.)","If the annotation is external, add its artifact as a deployment-time dependency so it gets indexed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"ClassInfo ci = index.getClassByName(DotName.createSimple(MyAnno.class.getName()));\nif (ci == null) { /* annotation not indexed; add artifact to build deps */ }","typeGuard":null,"tryCatchPattern":"try {\n    proxyProvider.builder(instance, MyAnno.class);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Failed to index:\")) {\n        // ensure annotation class is on build classpath and indexed\n    }\n}","preventionTips":["Keep custom annotations in indexed application/extension modules","Check the 'Caused by' for class-read failures","Avoid relying on annotations from unindexed external jars"],"tags":["jandex","indexing","classpath","annotation"],"backgroundTag":"class-not-indexed","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"}