{"record":{"id":"a4a9126b513d2122","repo":"quarkusio/quarkus","slug":"the-decorator-decoratorclass-has-multiple-dele","errorCode":null,"errorMessage":"The decorator ${decoratorClass} has multiple @Delegate injection points: ${delegateInjectionPoints}","messagePattern":"The decorator (.+?) has multiple @Delegate injection points: (.+?)","errorType":"exception","errorClass":"DefinitionException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Decorators.java","lineNumber":54,"sourceCode":"     */\n    static DecoratorInfo createDecorator(ClassInfo decoratorClass, BeanDeployment beanDeployment,\n            InjectionPointModifier transformer) {\n\n        // Find the delegate injection point\n        List<InjectionPointInfo> delegateInjectionPoints = new ArrayList<>();\n        List<Injection> injections = Injection.forBean(decoratorClass, null, beanDeployment, transformer,\n                Injection.BeanType.DECORATOR);\n        for (Injection injection : injections) {\n            for (InjectionPointInfo injectionPoint : injection.injectionPoints) {\n                if (injectionPoint.isDelegate()) {\n                    delegateInjectionPoints.add(injectionPoint);\n                }\n            }\n        }\n        if (delegateInjectionPoints.isEmpty()) {\n            throw new DefinitionException(\"The decorator \" + decoratorClass + \" has no @Delegate injection point\");\n        } else if (delegateInjectionPoints.size() > 1) {\n            throw new DefinitionException(\n                    \"The decorator \" + decoratorClass + \" has multiple @Delegate injection points: \" + delegateInjectionPoints);\n        }\n\n        InjectionPointInfo delegateInjectionPoint = delegateInjectionPoints.get(0);\n\n        Integer priority = null;\n        for (AnnotationInstance annotation : beanDeployment.getAnnotations(decoratorClass)) {\n            if (annotation.name().equals(DotNames.PRIORITY)) {\n                priority = annotation.value().asInt();\n            }\n            ScopeInfo scopeAnnotation = beanDeployment.getScope(annotation.name());\n            if (scopeAnnotation != null && !BuiltinScope.DEPENDENT.is(scopeAnnotation)) {\n                throw new DefinitionException(\n                        \"A decorator must be @Dependent but \" + decoratorClass + \" declares \" + scopeAnnotation.getDotName());\n            }\n        }\n\n        //  The set includes all bean types which are Java interfaces, except for java.io.Serializable","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Decorators.java#L36-L72","documentation":"CDI forbids more than one @Delegate injection point per decorator because the delegate target must be unambiguous. Arc raises a DefinitionException listing all delegate injection points found on the decorator class.","triggerScenarios":"A decorator class declares two or more fields (or constructor parameters) annotated @Delegate - often after merging decorator implementations or copying fields during refactoring.","commonSituations":"Merging two decorators into one class; keeping an old delegate field after adding a new one; Lombok or code generation duplicating delegate members.","solutions":["Keep exactly one @Delegate field and remove or un-annotate the others","If both are needed, split the decorator into two decorator classes","Delegate to one and implement the other members via normal injection instead of @Delegate"],"exampleFix":"// before\n@Delegate @Inject Audited a;\n@Delegate @Inject Logged l;\n// after\n@Delegate @Inject Audited a; // l removed or not annotated","handlingStrategy":"validation","validationCode":"static void requireSingleDelegate(Class<?> decorator) {\n  long n = java.util.Arrays.stream(decorator.getDeclaredFields())\n      .filter(f -> f.isAnnotationPresent(jakarta.decorator.Delegate.class)).count();\n  if (n > 1) throw new IllegalStateException(decorator + \" has \" + n + \" @Delegate injection points\");\n}","typeGuard":"static boolean hasSingleDelegate(Class<?> decorator) {\n  return java.util.Arrays.stream(decorator.getDeclaredFields())\n      .filter(f -> f.isAnnotationPresent(jakarta.decorator.Delegate.class)).count() == 1;\n}","tryCatchPattern":null,"preventionTips":["Only one field per decorator may carry @Delegate","When merging decorators, strip duplicate delegate fields"],"tags":["quarkus","arc","cdi","decorator","delegate"],"backgroundTag":"multiple-delegate-injection-points","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}