{"record":{"id":"1e568e084ae06ee2","repo":"quarkusio/quarkus","slug":"declaring-more-than-one-interceptionproxy-paramete","errorCode":null,"errorMessage":"Declaring more than one InterceptionProxy parameter is invalid: ${producerMethod}","messagePattern":"Declaring more than one InterceptionProxy parameter is invalid: (.+?)","errorType":"exception","errorClass":"DefinitionException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Beans.java","lineNumber":201,"sourceCode":"                        \"Ignoring producer method %s - declared as an @Alternative but not selected by @Priority or quarkus.arc.selected-alternatives\",\n                        declaringBean.getTarget().get().asClass().name() + \"#\" + producerMethod.name());\n                return null;\n            }\n        }\n\n        if (scope != null // `null` is just like `@Dependent`\n                && !BuiltinScope.DEPENDENT.is(scope)\n                && producerMethod.returnType().kind() == Kind.PARAMETERIZED_TYPE\n                && Types.containsTypeVariable(producerMethod.returnType())) {\n            throw new DefinitionException(\"Producer method return type is a parameterized type with a type variable, \"\n                    + \"its scope must be @Dependent: \" + producerMethod);\n        }\n\n        InterceptionProxyInfo interceptionProxy = null;\n        for (MethodParameterInfo parameter : producerMethod.parameters()) {\n            if (parameter.type().name().equals(DotNames.INTERCEPTION_PROXY)) {\n                if (interceptionProxy != null) {\n                    throw new DefinitionException(\n                            \"Declaring more than one InterceptionProxy parameter is invalid: \" + producerMethod);\n                }\n                if (parameter.type().kind() != Kind.PARAMETERIZED_TYPE) {\n                    throw new DefinitionException(\n                            \"InterceptionProxy parameter must be a parameterized type: \" + producerMethod);\n                }\n                DotName targetClass = producerMethod.returnType().name();\n                DotName bindingsSource = null;\n                if (parameter.hasAnnotation(DotNames.BINDINGS_SOURCE)) {\n                    Type bindingsSourceType = parameter.annotation(DotNames.BINDINGS_SOURCE).value().asClass();\n                    if (bindingsSourceType.kind() != Kind.CLASS) {\n                        throw new DefinitionException(\"@BindingsSource may only define a class type, got \"\n                                + bindingsSourceType.kind() + \": \" + producerMethod);\n                    }\n                    bindingsSource = bindingsSourceType.name();\n                }\n                interceptionProxy = new InterceptionProxyInfo(targetClass, bindingsSource);\n            }","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Beans.java#L183-L219","documentation":"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.","triggerScenarios":"A @Produces method declares two parameters whose type is io.quarkus.arc.InterceptionProxy; the loop over producerMethod.parameters() detects interceptionProxy already set.","commonSituations":"Copy-paste duplicating an InterceptionProxy parameter; misunderstanding InterceptionProxy as a repeatable helper type; refactoring merging two producer signatures.","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."],"exampleFix":"// before\n@Produces\nThing make(InterceptionProxy<Thing> p1, InterceptionProxy<Thing> p2) { ... }\n// after\n@Produces\nThing make(InterceptionProxy<Thing> proxy) {\n  return proxy.create();\n}","handlingStrategy":"validation","validationCode":"long proxyParams = Arrays.stream(m.getParameterTypes())\n        .filter(t -> t == InterceptionProxy.class).count();\nif (proxyParams > 1) {\n    throw new IllegalStateException(\"At most one InterceptionProxy parameter allowed: \" + m);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare exactly one InterceptionProxy parameter per producer","Use proxy.create(...) for each interception need from the single instance","Review producer signatures when merging refactors"],"tags":["cdi","quarkus-arc","interception-proxy","producer-method"],"backgroundTag":"duplicate-interceptionproxy-parameter","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}