quarkusio/quarkus · error · DefinitionException
The decorator ${decoratorClass} has no decorated type
Error message
The decorator ${decoratorClass} has no decorated type What it means
A bean annotated @Decorator must declare at least one @Delegate injection point whose type is an interface also listed among the decorator's decorated types. Arc's Decorators.createDecorator collects the decorator's interface types as decorated types; if none resolve (no interfaces, or only classes), no decorated type exists and deployment fails with this DefinitionException.
Source
Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Decorators.java:86
"A decorator must be @Dependent but " + decoratorClass + " declares " + scopeAnnotation.getDotName());
}
}
// The set includes all bean types which are Java interfaces, except for java.io.Serializable
TypeClosure typeClosure = Types.getClassBeanTypeClosure(decoratorClass, beanDeployment);
Set<Type> types = typeClosure.types();
Set<Type> decoratedTypes = new HashSet<>();
for (Type type : types) {
if (type.name().equals(DotNames.SERIALIZABLE)) {
continue;
}
ClassInfo clazz = beanDeployment.getBeanArchiveIndex().getClassByName(type.name());
if (Modifier.isInterface(clazz.flags())) {
decoratedTypes.add(type);
}
}
if (decoratedTypes.isEmpty()) {
throw new DefinitionException("The decorator " + decoratorClass + " has no decorated type");
}
// The delegate type of a decorator must implement or extend every decorated type
Set<Type> delegateTypes = Types.getDelegateTypeClosure(delegateInjectionPoint, beanDeployment);
for (Type decoratedType : decoratedTypes) {
if (!delegateTypes.contains(decoratedType)) {
throw new DefinitionException("The delegate type " + delegateInjectionPoint.getRequiredType()
+ " does not implement the decorated type: " + decoratedType);
}
for (BuiltinBean bean : BuiltinBean.values()) {
if (bean.equals(BuiltinBean.RESOURCE)) {
// do not take Resource into consideration
continue;
}
if (bean.hasRawTypeDotName(decoratedType.name())) {
throw new UnsupportedOperationException("Decorating built-in bean types is not supported! " +
"Decorator " + decoratorClass + " is attempting to decorate " + decoratedType.name());
}View on GitHub (pinned to e1c734241f)
Solutions
- Make the decorator class implement at least one interface and give it a @Delegate field of that interface type.
- Ensure the @Delegate injection point's required type matches (implements/extends) the interface being decorated.
- Verify the interface and decorator are in an indexed bean archive and not excluded by discovery filters.
- Rebuild after refactors so the Jandex index reflects the current class hierarchy.
Example fix
// before
@Decorator
public class TracedService {
@Delegate
Service service; // no interface implemented
}
// after
@Decorator
public class TracedService implements Service {
@Delegate
Service delegate;
} Defensive patterns
Strategy: validation
Validate before calling
if (!java.lang.reflect.Modifier.isInterface(Decorator.class.getInterfaces().length > 0 ? Decorator.class.getInterfaces()[0].getModifiers() : 0) || Decorator.class.getInterfaces().length == 0) throw new IllegalStateException("@Decorator must implement at least one interface"); Prevention
- Always pair @Decorator with 'implements SomeInterface' and a @Delegate field of that interface.
- Write an ArchUnit/architecture test asserting every @Decorator class has interfaces and a @Delegate member.
- Rebuild the Jandex index after interface refactors.
When it happens
Trigger: Registering a class as a @Decorator that implements no interface, or whose @Delegate injection point type matches none of its interfaces, so the decoratedTypes set stays empty in createDecorator.
Common situations: Forgetting to implement any interface on the decorator; @Delegate pointing at a concrete class type; typos in generics; a refactor removing the implemented interface; moving the decorator to a bean archive where the interface is not indexed.
Related errors
- Decorated interface ${decoratedType} not found in the index
- The delegate type ${delegateInjectionPoint.getRequiredType()
- Abstract decorator ${decoratorClass.name()} declares abstrac
- Unsupported injection point target: <injectionPoint>
- 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/786cc8183d2e4de8.
Report an issue: GitHub.