quarkusio/quarkus · error · IllegalArgumentException

Invalid annotation target: <target>

Error message

Invalid annotation target: <target>

What it means

DevBeanInfo.from() converts a BeanInfo into a Dev UI JSON model. It inspects the bean's annotation target kind to determine whether the bean is a producer method, producer field, or class-based bean; any other target kind is rejected with IllegalArgumentException('Invalid annotation target: <target>').

Source

Thrown at extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/devui/DevBeanInfo.java:76

                isApplicationBean = predicate.test(bean.getDeclaringBean().getBeanClass());
                declaringClass = Name.from(bean.getDeclaringBean().getBeanClass());
                isGenerated = bean.getDeclaringBean().getImplClazz().isSynthetic();
            } else if (target.kind() == Kind.FIELD) {
                FieldInfo field = target.asField();
                memberName = field.name();
                kind = DevBeanKind.FIELD;
                isApplicationBean = predicate.test(bean.getDeclaringBean().getBeanClass());
                declaringClass = Name.from(bean.getDeclaringBean().getBeanClass());
                isGenerated = bean.getDeclaringBean().getImplClazz().isSynthetic();
            } else if (target.kind() == Kind.CLASS) {
                ClassInfo clazz = target.asClass();
                kind = DevBeanKind.CLASS;
                memberName = null;
                isApplicationBean = predicate.test(clazz.name());
                isGenerated = clazz.isSynthetic();
                declaringClass = null;
            } else {
                throw new IllegalArgumentException("Invalid annotation target: " + target);
            }
            return new DevBeanInfo(bean.getIdentifier(), kind, isApplicationBean, providerType, memberName, types, qualifiers,
                    scope, declaringClass,
                    interceptors, isGenerated);
        } else {
            // Synthetic bean
            return new DevBeanInfo(bean.getIdentifier(), DevBeanKind.SYNTHETIC, false, providerType, null, types, qualifiers,
                    scope, null,
                    interceptors, bean.getImplClazz().isSynthetic());
        }
    }

    public DevBeanInfo(String id, DevBeanKind kind, boolean isApplicationBean, Name providerType, String memberName,
            Set<Name> types,
            Set<Name> qualifiers, Name scope, Name declaringClass, List<String> boundInterceptors,
            boolean isGenerated) {
        this.id = id;
        this.kind = kind;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Find the bean/extension producing the unusual annotation target (name is printed in the message) and fix its registration
  2. Update Quarkus — the Dev UI renderer may already support more target kinds in newer versions
  3. Temporarily remove the offending synthetic bean registration to confirm the source extension
  4. Report the issue to the extension maintainer / Quarkus with the Dev UI bean identifier

Example fix

// before (extension): bean registered with an unusual parameter target
// after: register as a normal class-based synthetic bean
SyntheticBeanBuildItem.configure(MyBean.class).types(MyBean.class).scope(Singleton.class)
    .supplier(recorder.create()).done();
Defensive patterns

Strategy: validation

Validate before calling

AnnotationTarget t = bean.getAnnotationTarget();
if (t != null && t.kind() != AnnotationTarget.Kind.CLASS
    && t.kind() != AnnotationTarget.Kind.METHOD
    && t.kind() != AnnotationTarget.Kind.FIELD) {
    // skip Dev UI rendering for this bean
}

Type guard

static boolean hasRenderableTarget(BeanInfo bean) {
    AnnotationTarget.Kind k = bean.getAnnotationTarget() == null ? null : bean.getAnnotationTarget().kind();
    return k == null || k == AnnotationTarget.Kind.CLASS || k == AnnotationTarget.Kind.METHOD || k == AnnotationTarget.Kind.FIELD;
}

Prevention

When it happens

Trigger: Rendering Dev UI bean info for a bean whose BeanInfo.getAnnotationTarget() is a non-null kind other than METHOD, FIELD, or CLASS — e.g. a parameter target or an unusual synthetic bean target produced by a custom extension.

Common situations: Custom extensions registering synthetic/odd beans whose targets confuse the Dev UI bean renderer; ArC internal changes making new target kinds visible in the beans list; opening Dev UI beans page in an app with such beans.

Related errors


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