quarkusio/quarkus · error · IllegalArgumentException

Annotation class not available:

Error message

Annotation class not available: 

What it means

AnnotationLiteralProcessor.create requires the Jandex ClassInfo for the annotation to generate the literal. When the annotation class is absent from the bean archive index (null ClassInfo), an IllegalArgumentException naming the annotation instance is thrown.

Source

Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralProcessor.java:91

     * have to check (and will get decent errors for free), but callers that can possibly deal
     * with class-retained annotations or missing annotation classes must check explicitly.
     * <p>
     * We call the generated implementation of the annotation type an <em>annotation literal class</em>
     * and the instance produced by the generated bytecode an <em>annotation literal instance</em>,
     * even though the generated code doesn't use CDI's {@code AnnotationLiteral}.
     *
     * @param bc will receive the bytecode sequence for instantiating the annotation literal class
     *        as a sequence of {@link BlockCreator} method calls
     * @param annotationClass the annotation type
     * @param annotationInstance the annotation instance; must match the {@code annotationClass}
     * @return an annotation literal instance result handle
     */
    public Expr create(BlockCreator bc, ClassInfo annotationClass, AnnotationInstance annotationInstance) {
        if (!annotationInstance.runtimeVisible()) {
            throw new IllegalArgumentException("Annotation does not have @Retention(RUNTIME): " + annotationInstance);
        }
        if (annotationClass == null) {
            throw new IllegalArgumentException("Annotation class not available: " + annotationInstance);
        }

        AnnotationLiteralClassInfo literal = cache.getValue(new CacheKey(annotationClass));

        ClassDesc generatedClass = ClassDesc.of(literal.generatedClassName);

        if (literal.annotationMembers().isEmpty()) {
            return bc.getStaticField(FieldDesc.of(generatedClass, "INSTANCE", generatedClass));
        }

        Expr[] ctorArgs = new Expr[literal.annotationMembers().size()];
        int argIndex = 0;
        for (MethodInfo annotationMember : literal.annotationMembers()) {
            AnnotationValue value = annotationInstance.value(annotationMember.name());
            if (value == null) {
                value = annotationMember.defaultValue();
            }
            if (value == null) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Index the dependency containing the annotation (add jandex-maven-plugin or a META-INF/jandex.idx)
  2. Ensure the annotation type is on the bean archive index path
  3. Verify the Jandex index is regenerated after dependency changes

Example fix

// before
<plugin> <groupId>org.jboss.jandex</groupId> <artifactId>jandex-maven-plugin</artifactId> <skip>true</skip> </plugin>
// after
<plugin> <groupId>org.jboss.jandex</groupId> <artifactId>jandex-maven-plugin</artifactId> <executions> <execution> <goals><goal>jandex</goal></goals> </execution> </executions> </plugin>
Defensive patterns

Strategy: validation

Validate before calling

if (index.getClassByName(DotName.createSimple(MyAnno.class.getName())) == null) throw new IllegalStateException("not indexed");

Prevention

When it happens

Trigger: Invoking create() for an annotation whose DotName cannot be resolved to ClassInfo in the supplied bean archive index.

Common situations: Dependencies not indexed by Jandex (missing jandex index or META-INF/jandex.idx); annotation types in un-indexed third-party jars; stale/incorrect Jandex version producing incomplete indexes.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/cfb792104d38e129. Report an issue: GitHub.