quarkusio/quarkus · error · IllegalStateException
Multiple beans with the same @Identifier value detected: ;
Error message
Multiple beans with the same @Identifier value detected: ; beans:
What it means
When discovering ordered components (enrichers/interceptors) of a given SPI type, the processor indexes beans by their @io.smallrye.common.annotation.Identifier value. Two or more beans carry the same identifier, making the ordering ambiguous, so the build fails.
Source
Thrown at extensions/signals/deployment/src/main/java/io/quarkus/signals/deployment/SignalsProcessor.java:392
List<String> orderedEnricherIds = discoverAndOrder(beanDiscovery, DotNames.SIGNAL_METADATA_ENRICHER,
"SignalMetadataEnricher");
List<String> orderedInterceptorIds = discoverAndOrder(beanDiscovery, DotNames.RECEIVER_INTERCEPTOR,
"ReceiverInterceptor");
return new OrderedSpiComponentsBuildItem(orderedEnricherIds, orderedInterceptorIds);
}
private static List<String> discoverAndOrder(BeanDiscoveryFinishedBuildItem beanDiscovery, DotName spiType,
String componentTypeName) {
Map<String, List<String>> beforeEdges = new HashMap<>();
Map<String, List<String>> afterEdges = new HashMap<>();
Map<String, List<BeanInfo>> idToBeans = new HashMap<>();
for (BeanInfo bean : beanDiscovery.beanStream().withBeanType(spiType)) {
String id = readIdentifier(bean, componentTypeName);
List<BeanInfo> beans = idToBeans.computeIfAbsent(id, k -> new ArrayList<>());
beans.add(bean);
if (beans.size() > 1) {
throw new IllegalStateException(
"Multiple " + componentTypeName
+ " beans with the same @Identifier value detected: " + id
+ "; beans: " + beans);
}
if (bean.getTarget().isPresent()) {
AnnotationInstance orderAnnotation = bean.getTarget().get().declaredAnnotation(DotNames.RELATIVE_ORDER);
if (orderAnnotation != null) {
AnnotationValue beforeValue = orderAnnotation.value("before");
if (beforeValue != null) {
beforeEdges.put(id, List.of(beforeValue.asStringArray()));
}
AnnotationValue afterValue = orderAnnotation.value("after");
if (afterValue != null) {
afterEdges.put(id, List.of(afterValue.asStringArray()));
}
}
}
}View on GitHub (pinned to e1c734241f)
Solutions
- Rename the @Identifier value on one of the duplicate beans so ids are unique.
- Remove one of the conflicting beans from the deployment (e.g. via @Exclude or uninstalling the extension/module).
- If a library bean conflicts, use a custom identifier for your own bean.
Example fix
// before
@Identifier("my-enricher")
class EnricherA implements Enricher { ... }
@Identifier("my-enricher")
class EnricherB implements Enricher { ... }
// after
@Identifier("my-enricher-a")
class EnricherA implements Enricher { ... }
@Identifier("my-enricher-b")
class EnricherB implements Enricher { ... } Defensive patterns
Strategy: validation
Validate before calling
Set<String> seen = new HashSet<>();
for (Class<?> c : List.of(EnricherA.class, EnricherB.class)) {
String id = c.getAnnotation(Identifier.class).value();
if (!seen.add(id)) throw new IllegalStateException("duplicate @Identifier: " + id);
} Prevention
- Use unique, prefix-qualified ids like "com.acme.my-enricher".
- Grep the codebase for @Identifier values before adding a new component.
- Centralize id constants to avoid string duplication.
When it happens
Trigger: Two beans implementing the same signals SPI interface (enricher or interceptor) both annotated with @Identifier("same-id").
Common situations: Adding a second implementation of an SPI but reusing an existing identifier string, or registering a library bean plus your own with the same id.
Related errors
- bean must be annotated with @io.smallrye.common.annotation
- bean has an @Identifier annotation with an empty value
- Multiple @Inject constructors on ${theClass}
- Quarkus does not support CDI Full @Specializes annotation; t
- IllegalStateException wrapping ClassNotFoundException for ge
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/a9d6562971fa373e.
Report an issue: GitHub.