quarkusio/quarkus · error · DefinitionException
Declaring more than one InterceptionProxy parameter is inval
Error message
Declaring more than one InterceptionProxy parameter is invalid: ${producerMethod} What it means
A producer method may declare at most one InterceptionProxy parameter. ArC validates producer method parameters in Beans.createProducerMethod and throws this DefinitionException when a second parameter of type InterceptionProxy is encountered.
Source
Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Beans.java:201
"Ignoring producer method %s - declared as an @Alternative but not selected by @Priority or quarkus.arc.selected-alternatives",
declaringBean.getTarget().get().asClass().name() + "#" + producerMethod.name());
return null;
}
}
if (scope != null // `null` is just like `@Dependent`
&& !BuiltinScope.DEPENDENT.is(scope)
&& producerMethod.returnType().kind() == Kind.PARAMETERIZED_TYPE
&& Types.containsTypeVariable(producerMethod.returnType())) {
throw new DefinitionException("Producer method return type is a parameterized type with a type variable, "
+ "its scope must be @Dependent: " + producerMethod);
}
InterceptionProxyInfo interceptionProxy = null;
for (MethodParameterInfo parameter : producerMethod.parameters()) {
if (parameter.type().name().equals(DotNames.INTERCEPTION_PROXY)) {
if (interceptionProxy != null) {
throw new DefinitionException(
"Declaring more than one InterceptionProxy parameter is invalid: " + producerMethod);
}
if (parameter.type().kind() != Kind.PARAMETERIZED_TYPE) {
throw new DefinitionException(
"InterceptionProxy parameter must be a parameterized type: " + producerMethod);
}
DotName targetClass = producerMethod.returnType().name();
DotName bindingsSource = null;
if (parameter.hasAnnotation(DotNames.BINDINGS_SOURCE)) {
Type bindingsSourceType = parameter.annotation(DotNames.BINDINGS_SOURCE).value().asClass();
if (bindingsSourceType.kind() != Kind.CLASS) {
throw new DefinitionException("@BindingsSource may only define a class type, got "
+ bindingsSourceType.kind() + ": " + producerMethod);
}
bindingsSource = bindingsSourceType.name();
}
interceptionProxy = new InterceptionProxyInfo(targetClass, bindingsSource);
}View on GitHub (pinned to e1c734241f)
Solutions
- Remove the duplicate InterceptionProxy parameter and use the single instance for all interceptions.
- If different target types are needed, split into separate producer methods, each with one InterceptionProxy.
Example fix
// before
@Produces
Thing make(InterceptionProxy<Thing> p1, InterceptionProxy<Thing> p2) { ... }
// after
@Produces
Thing make(InterceptionProxy<Thing> proxy) {
return proxy.create();
} Defensive patterns
Strategy: validation
Validate before calling
long proxyParams = Arrays.stream(m.getParameterTypes())
.filter(t -> t == InterceptionProxy.class).count();
if (proxyParams > 1) {
throw new IllegalStateException("At most one InterceptionProxy parameter allowed: " + m);
} Prevention
- Declare exactly one InterceptionProxy parameter per producer
- Use proxy.create(...) for each interception need from the single instance
- Review producer signatures when merging refactors
When it happens
Trigger: A @Produces method declares two parameters whose type is io.quarkus.arc.InterceptionProxy; the loop over producerMethod.parameters() detects interceptionProxy already set.
Common situations: Copy-paste duplicating an InterceptionProxy parameter; misunderstanding InterceptionProxy as a repeatable helper type; refactoring merging two producer signatures.
Related errors
- Producer method return type is a parameterized type with a t
- No InterceptionProxy registered for this synthetic bean; cal
- Unsupported injection point target: <injectionPoint>
- Calling injectInterceptionProxy() more than once is invalid
- Method ${method} of class ${beanClass} is not a producer met
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/1e568e084ae06ee2.
Report an issue: GitHub.