quarkusio/quarkus · error · DefinitionException

Interceptor has no bindings:

Error message

Interceptor has no bindings: 

What it means

ArC throws this DefinitionException when an @Interceptor class declares no interceptor binding annotations (@InterceptorBinding-annotated annotation types). Every interceptor must bind to at least one binding annotation so it can be matched to intercepted beans. Raised at build time during interceptor creation; the application fails to deploy.

Source

Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Interceptors.java:55

    static InterceptorInfo createInterceptor(ClassInfo interceptorClass, BeanDeployment beanDeployment,
            InjectionPointModifier transformer) {
        Integer priority = null;
        for (AnnotationInstance annotation : beanDeployment.getAnnotations(interceptorClass)) {
            if (annotation.name().equals(DotNames.PRIORITY)) {
                priority = annotation.value().asInt();
            }
            // rudimentary, but good enough for now (should also look at inherited annotations and stereotypes)
            ScopeInfo scope = beanDeployment.getScope(annotation.name());
            if (scope != null && !BuiltinScope.DEPENDENT.is(scope)) {
                throw new DefinitionException("Interceptor declares scope other than @Dependent: " + interceptorClass);
            }
        }

        Set<AnnotationInstance> bindings = new HashSet<>();
        addBindings(beanDeployment, interceptorClass, bindings, false);

        if (bindings.isEmpty()) {
            throw new DefinitionException("Interceptor has no bindings: " + interceptorClass);
        }

        if (priority == null) {
            if (beanDeployment.strictCompatibility) {
                // interceptor without `@Priority` is disabled per the specification
                return null;
            }

            LOGGER.info("The interceptor " + interceptorClass + " does not declare any @Priority. " +
                    "It will be assigned a default priority value of 0.");
            priority = 0;
        }

        checkClassLevelInterceptorBindings(bindings, interceptorClass, beanDeployment);
        checkInterceptorFieldsAndMethods(interceptorClass, beanDeployment);

        return new InterceptorInfo(interceptorClass, beanDeployment,
                bindings.size() == 1 ? Set.of(bindings.iterator().next())

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add an interceptor binding annotation (one meta-annotated with @InterceptorBinding) to the interceptor class.
  2. Verify the binding annotation itself is meta-annotated with @InterceptorBinding and @Retention(RUNTIME).
  3. Remove the @Interceptor annotation entirely if the class is not meant to be an interceptor.

Example fix

// before
@Interceptor
@Priority(100)
class LoggingInterceptor { }
// after
@Interceptor
@Priority(100)
@Logged
class LoggingInterceptor { }
Defensive patterns

Strategy: validation

Validate before calling

boolean hasBinding = java.util.Arrays.stream(LoggingInterceptor.class.getAnnotations())
    .anyMatch(a -> a.annotationType().isAnnotationPresent(jakarta.interceptor.InterceptorBinding.class));
if (!hasBinding) throw new IllegalStateException("Interceptor must declare at least one @InterceptorBinding");

Prevention

When it happens

Trigger: Declaring a class with @Interceptor but no binding annotation (e.g. missing @Logged); the binding annotation accidentally losing its @InterceptorBinding meta-annotation; the binding annotation on a superclass rather than the interceptor class itself when addBindings with inherited=false finds none.

Common situations: Creating a new interceptor and forgetting the binding annotation; renaming the binding annotation so it is no longer meta-annotated with @InterceptorBinding; removing the binding during refactoring while keeping @Interceptor.

Related errors


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