quarkusio/quarkus · error · DefinitionException

No parameter of type BeanInfo or ObserverInfo for method " +

Error message

No parameter of type BeanInfo or ObserverInfo for method " + method

What it means

A build-time @Registration extension method must declare exactly one query parameter of type BeanInfo or ObserverInfo, which identifies the bean or observer being registered. ExtensionPhaseRegistration.runExtensionMethod() throws DefinitionException when no such parameter exists, because the registration callback has nothing to register against.

Source

Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/bcextensions/ExtensionPhaseRegistration.java:52

        this.assignability = new io.quarkus.arc.processor.AssignabilityCheck(beanArchiveIndex, null);
    }

    void runExtensionMethod(ExtensionMethod method) throws ReflectiveOperationException {
        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);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add a BeanInfo parameter (for bean registration) or ObserverInfo parameter (for observer registration) to the @Registration method.
  2. Remove the @Registration annotation if the method is not meant to register beans/observers.
  3. Confirm the parameter type is Arc's BeanInfo/ObserverInfo (io.quarkus.arc.processor) and not a same-named class from another dependency.

Example fix

// before
@Registration
void register(RegistrationContext ctx) { ... }

// after
@Registration
void register(BeanInfo bean, RegistrationContext ctx) { ... }
Defensive patterns

Strategy: validation

Validate before calling

boolean hasTarget = Arrays.stream(method.getParameters())
    .map(p -> p.type().name().withoutPackagePrefix())
    .anyMatch(n -> n.equals("BeanInfo") || n.equals("ObserverInfo"));
if (!hasTarget) throw new IllegalStateException("@Registration method needs BeanInfo or ObserverInfo parameter");

Type guard

static boolean hasRegistrationTarget(MethodInfo m) {
    return Arrays.stream(m.parameters()).anyMatch(p ->
        p.type().name().withoutPackagePrefix().equals("BeanInfo")
        || p.type().name().withoutPackagePrefix().equals("ObserverInfo"));
}

Try / catch

try {
    processor.run(extensionClass);
} catch (DefinitionException e) {
    fail("@Registration method missing BeanInfo/ObserverInfo: " + e.getMessage());
}

Prevention

When it happens

Trigger: Annotating a method with @Registration whose parameters contain neither BeanInfo nor ObserverInfo (e.g. only context/config types or no parameters at all), so numQueryParameters == 0 at processing time.

Common situations: Writing a registration callback that only captures the RegistrationContext and forgetting the BeanInfo/ObserverInfo argument; converting a method from another phase where BeanInfo is invalid and dropping it; typos importing a similarly named type.

Related errors


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