quarkusio/quarkus · error · UnsupportedOperationException
Decorating built-in bean types is not supported! Decorator $
Error message
Decorating built-in bean types is not supported! Decorator ${decoratorClass} is attempting to decorate ${decoratedType.name()} What it means
Arc forbids decorating built-in bean types such as Instance, Event, BeanManager, or resource types. If a decorator's decorated type's raw name matches a BuiltinBean, createDecorator throws this UnsupportedOperationException because interception of built-in beans is not supported.
Source
Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Decorators.java:102
}
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());
}
}
}
if (priority == null) {
if (beanDeployment.strictCompatibility) {
// decorator without `@Priority` is disabled per the specification
return null;
}
LOGGER.info("The decorator " + decoratorClass + " does not declare any @Priority. " +
"It will be assigned a default priority value of 0.");
priority = 0;
}
if (Modifier.isAbstract(decoratorClass.flags())) {
JandexTypeSystem ts = JandexTypeSystem.of(beanDeployment.getBeanArchiveIndex());View on GitHub (pinned to e1c734241f)
Solutions
- Do not decorate built-in types; wrap the usage in your own interface or intercept at your own bean instead.
- For events, create your own event abstraction/facade and decorate that.
- Use an observer or explicit wrapper class instead of @Decorator for built-in behavior.
- Ensure the decorated type's raw type is your application interface, not a javax/jakarta or Arc built-in.
Example fix
// before
@Decorator
public class EventLogger implements Event<Payload> { ... }
// after
public interface PayloadEventDispatcher { void dispatch(Payload p); }
@Decorator
public class EventLogger implements PayloadEventDispatcher { @Delegate PayloadEventDispatcher delegate; } Defensive patterns
Strategy: validation
Validate before calling
Set<String> builtins = Set.of("jakarta.enterprise.inject.Instance","jakarta.enterprise.event.Event","jakarta.enterprise.inject.spi.BeanManager");
for (Class<?> itf : decorator.getClass().getInterfaces())
if (builtins.contains(itf.getName())) throw new IllegalStateException("Cannot decorate built-in type " + itf); Prevention
- Never write 'implements Instance<...>' or 'implements Event<...>' on a decorator.
- Wrap built-in usage behind your own application interface if decoration is needed.
- Code-review decorator interfaces for jakarta/javax built-in raw types.
When it happens
Trigger: Writing @Decorator SomeDecorator implements Instance<Foo> or decorating Event/BeanManager/other BuiltinBean raw types; only BuiltinBean.RESOURCE is skipped from the check.
Common situations: Trying to add cross-cutting behavior around Event firing or Instance resolution; misreading the spec that decorators apply only to managed beans; copying a decorator onto a built-in type interface.
Related errors
- Decorated interface ${decoratedType} not found in the index
- Injected @Decorated Bean<> has to use the delegate type as i
- Unable to construct type for ${decorator}: ${e.getMessage()}
- Decorated type not found in the bean archive index: ${decora
- The decorator ${decoratorClass} has no @Delegate injection p
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/f63d458607ae6f30.
Report an issue: GitHub.