quarkusio/quarkus · error · DefinitionException
More than 1 parameter of type BeanInfo or ObserverInfo for m
Error message
More than 1 parameter of type BeanInfo or ObserverInfo for method " + method
What it means
Each build-time @Registration extension method may declare only one query parameter — a single BeanInfo or ObserverInfo identifying the target of the registration. ExtensionPhaseRegistration.runExtensionMethod() throws DefinitionException when more than one such parameter is present, since a method registers exactly one bean or observer per invocation.
Source
Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/bcextensions/ExtensionPhaseRegistration.java:56
int numQueryParameters = 0;
List<ExtensionMethodParameter> parameters = new ArrayList<>(method.parametersCount());
for (org.jboss.jandex.Type parameterType : method.parameterTypes()) {
ExtensionMethodParameter parameter = ExtensionMethodParameter.of(parameterType);
parameters.add(parameter);
if (parameter.isQuery()) {
numQueryParameters++;
}
parameter.verifyAvailable(ExtensionPhase.REGISTRATION, method);
}
if (numQueryParameters == 0) {
throw new DefinitionException("No parameter of type BeanInfo or ObserverInfo for method " + method);
}
if (numQueryParameters > 1) {
throw new DefinitionException("More than 1 parameter of type BeanInfo or ObserverInfo for method " + method);
}
ExtensionMethodParameter query = parameters.stream()
.filter(ExtensionMethodParameter::isQuery)
.findAny()
.get(); // guaranteed to be there
List<?> allValuesForQueryParameter = Collections.emptyList();
if (query == ExtensionMethodParameter.BEAN_INFO) {
allValuesForQueryParameter = matchingBeans(method.jandex, false);
} else if (query == ExtensionMethodParameter.INTERCEPTOR_INFO) {
allValuesForQueryParameter = matchingBeans(method.jandex, true);
} else if (query == ExtensionMethodParameter.OBSERVER_INFO) {
allValuesForQueryParameter = matchingObservers(method.jandex);
}
for (Object queryParameterValue : allValuesForQueryParameter) {
List<Object> arguments = new ArrayList<>();View on GitHub (pinned to e1c734241f)
Solutions
- Keep exactly one BeanInfo or ObserverInfo parameter and remove the other.
- Split into two @Registration methods — one for the bean, one for the observer.
- If you need related metadata, derive it from the single query parameter rather than adding extra info parameters.
Example fix
// before
@Registration
void register(BeanInfo bean, ObserverInfo observer) { ... }
// after
@Registration
void registerBean(BeanInfo bean) { ... }
@Registration
void registerObserver(ObserverInfo observer) { ... } Defensive patterns
Strategy: validation
Validate before calling
long targets = Arrays.stream(method.getParameters())
.map(p -> p.type().name().withoutPackagePrefix())
.filter(n -> n.equals("BeanInfo") || n.equals("ObserverInfo"))
.count();
if (targets > 1) throw new IllegalStateException("@Registration method must take exactly one BeanInfo or ObserverInfo"); Type guard
static boolean isSingleTargetRegistration(MethodInfo m) {
return Arrays.stream(m.parameters()).filter(p ->
Set.of("BeanInfo","ObserverInfo").contains(p.type().name().withoutPackagePrefix())).count() == 1;
} Try / catch
try {
processor.run(extensionClass);
} catch (DefinitionException e) {
fail("Multiple registration targets: " + e.getMessage());
} Prevention
- One registration target per @Registration method; use separate methods for beans vs observers.
- Derive related metadata from the single target parameter.
- Review extension signatures against the 'exactly one query parameter' rule.
When it happens
Trigger: Declaring an @Registration method with both a BeanInfo and an ObserverInfo parameter (or two BeanInfo parameters), making numQueryParameters > 1 when Arc processes the extension.
Common situations: Trying to register a bean and its observer in a single callback; adding an extra BeanInfo parameter hoping to see related beans; copy-paste from a synthesis-phase method with different rules.
Related errors
- phase + " methods can't declare a parameter of type " + (typ
- No parameter of type ClassInfo, MethodInfo, FieldInfo, Class
- More than 1 parameter of type ClassInfo, MethodInfo, FieldIn
- No parameter of type BeanInfo or ObserverInfo for method " +
- Quarkus does not support CDI Full @Specializes annotation; t
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/5dd93dde6bcae80d.
Report an issue: GitHub.