quarkusio/quarkus · error · IllegalStateException
Class of nested annotation missing
Error message
Class of nested annotation missing
What it means
While loading NESTED annotation member values for a generated literal, Arc must resolve the nested annotation's ClassInfo from the bean archive index. If getClassByName returns null, IllegalStateException 'Class of nested annotation ... missing' is thrown.
Source
Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralProcessor.java:168
case ENUM -> {
ClassDesc enumDesc = classDescOf(annotationMemberValue.asEnumType());
yield bc.getStaticField(FieldDesc.of(enumDesc, annotationMemberValue.asEnum(), enumDesc));
}
case CLASS -> {
if (annotationMemberValue.equals(annotationMember.defaultValue())) {
yield bc.getStaticField(FieldDesc.of(ClassDesc.of(literal.generatedClassName),
AnnotationLiteralGenerator.defaultValueStaticFieldName(annotationMember),
classDescOf(annotationMember.returnType())));
} else {
yield Const.of(classDescOf(annotationMemberValue.asClass()));
}
}
case NESTED -> {
AnnotationInstance nestedAnnotation = annotationMemberValue.asNested();
DotName annotationName = nestedAnnotation.name();
ClassInfo annotationClass = beanArchiveIndex.getClassByName(annotationName);
if (annotationClass == null) {
throw new IllegalStateException("Class of nested annotation " + nestedAnnotation + " missing");
}
yield create(bc, annotationClass, nestedAnnotation);
}
case ARRAY -> {
AnnotationValue.Kind componentKind = annotationMemberValue.componentKind();
yield switch (componentKind) {
case BOOLEAN -> {
boolean[] booleanArray = annotationMemberValue.asBooleanArray();
Expr[] exprArray = new Expr[booleanArray.length];
for (int i = 0; i < booleanArray.length; i++) {
exprArray[i] = Const.of(booleanArray[i]);
}
yield bc.newArray(boolean.class, exprArray);
}
case BYTE -> {
byte[] byteArray = annotationMemberValue.asByteArray();
Expr[] exprArray = new Expr[byteArray.length];
for (int i = 0; i < byteArray.length; i++) {View on GitHub (pinned to e1c734241f)
Solutions
- Index the jar containing the nested annotation type
- Ensure the nested annotation class is a dependency of the bean archive
- Regenerate the Jandex index after adding the dependency
Example fix
// before // nested annotation class not indexed // after // add jandex plugin / META-INF/jandex.idx to the module declaring the nested annotation
Defensive patterns
Strategy: validation
Validate before calling
if (index.getClassByName(DotName.createSimple(NestedAnno.class.getName())) == null) throw new IllegalStateException("not indexed"); Prevention
- Index nested annotation modules
When it happens
Trigger: An annotation member of nested-annotation type whose annotation class is absent from the bean archive index, resolved in loadValue's NESTED case.
Common situations: Nested annotation types living in jars not indexed by Jandex; missing jandex.idx; annotation class in a module not visible to the archive index.
Related errors
- Annotation does not have @Retention(RUNTIME):
- Annotation class not available:
- Value is not set for %s.%s(). Most probably an older version
- Array component kind is
- Unknown annotation attribute value:
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/31b1d7e18eef3b85.
Report an issue: GitHub.