quarkusio/quarkus · error · IllegalStateException

bean has no target:

Error message

 bean has no target: 

What it means

readIdentifier needs the bean's target (the method or class the bean resolves to) to read its annotations. A bean of the component SPI type with no target cannot be identified or ordered, so the build fails.

Source

Thrown at extensions/signals/deployment/src/main/java/io/quarkus/signals/deployment/SignalsProcessor.java:420

                        beforeEdges.put(id, List.of(beforeValue.asStringArray()));
                    }
                    AnnotationValue afterValue = orderAnnotation.value("after");
                    if (afterValue != null) {
                        afterEdges.put(id, List.of(afterValue.asStringArray()));
                    }
                }
            }
        }

        if (idToBeans.keySet().isEmpty()) {
            return List.of();
        }
        return TopologicalSort.sort(idToBeans.keySet(), beforeEdges, afterEdges, componentTypeName);
    }

    private static String readIdentifier(BeanInfo bean, String componentTypeName) {
        if (bean.getTarget().isEmpty()) {
            throw new IllegalStateException(componentTypeName + " bean has no target: " + bean);
        }
        Optional<AnnotationInstance> identifier = bean.getQualifier(DotNames.IDENTIFIER);
        if (identifier.isEmpty()) {
            throw new IllegalStateException(
                    componentTypeName + " bean " + bean.getBeanClass()
                            + " must be annotated with @io.smallrye.common.annotation.Identifier");
        }
        AnnotationValue value = identifier.get().value();
        if (value == null || value.asString().isBlank()) {
            throw new IllegalStateException(
                    componentTypeName + " bean " + bean.getBeanClass()
                            + " has an @Identifier annotation with an empty value");
        }
        return value.asString();
    }

    @BuildStep
    ReceiverExecutorImplementationBuildItem supportedExecutionModels(Capabilities capabilities) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Declare the component as a plain managed bean class implementing the SPI instead of a producer/synthetic bean.
  2. If using a producer, ensure the produced type resolves to a target the container can inspect.
  3. Check for an extension-generated bean and switch to a directly annotated class.

Example fix

// before
@Produces
Enricher myEnricher() { return new MyEnricher(); }

// after
@Identifier("my-enricher")
class MyEnricher implements Enricher { ... }
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the component is a plain managed bean class, not produced/synthetic:
if (componentClass.isAnonymousClass() || componentClass.isLocalClass()) { throw new IllegalStateException("declare SPI component as a normal bean class"); }

Prevention

When it happens

Trigger: A bean implementing the signals SPI type (enricher/interceptor) whose BeanInfo has an empty target — typically a synthetic/producer-derived bean with no concrete method or class target.

Common situations: Registering the SPI component via a producer method or synthetic bean extension rather than a plain bean class, which yields no target.

Related errors


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