quarkusio/quarkus · error · java.lang.IllegalArgumentException

No InterceptionProxy registered for this synthetic bean; cal

Error message

No InterceptionProxy registered for this synthetic bean; call injectInterceptionProxy()

What it means

SyntheticCreationalContextImpl.getInterceptionProxy() looks for an injected InterceptionProxy among the synthetic bean's injected references. If none was registered via injectInterceptionProxy(), it throws this IllegalArgumentException. InterceptionProxy for synthetic beans must be explicitly requested during bean creation.

Source

Thrown at independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/SyntheticCreationalContextImpl.java:65

    @Override
    public <R> R getInjectedReference(Class<R> requiredType, Annotation... qualifiers) {
        return getReference(requiredType, qualifiers);
    }

    @Override
    public <R> R getInjectedReference(TypeLiteral<R> requiredType, Annotation... qualifiers) {
        return getReference(requiredType.getType(), qualifiers);
    }

    @Override
    public <R> InterceptionProxy<R> getInterceptionProxy() {
        for (Map.Entry<TypeAndQualifiers, Object> entry : injectedReferences.entrySet()) {
            if (entry.getKey().requiredType.getTypeName().startsWith(InterceptionProxy.class.getName())) {
                return (InterceptionProxy<R>) entry.getValue();
            }
        }
        throw new IllegalArgumentException(
                "No InterceptionProxy registered for this synthetic bean; call injectInterceptionProxy()");
    }

    @SuppressWarnings("unchecked")
    private <R> R getReference(Type requiredType, Annotation... qualifiers) {
        if (qualifiers.length == 0) {
            qualifiers = new Annotation[] { Default.Literal.INSTANCE };
        }
        R ref = (R) injectedReferences.get(new TypeAndQualifiers(requiredType, qualifiers));
        if (ref == null) {
            throw new IllegalArgumentException("A synthetic injection point was not declared for required type [" + requiredType
                    + " and qualifiers: " + Arrays.toString(qualifiers));
        }
        return ref;
    }

    public final static class TypeAndQualifiers {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Call injectInterceptionProxy() when configuring the SyntheticBeanBuildItem
  2. Then use creationalContext.getInterceptionProxy() inside the create function
  3. Alternatively inject the InterceptionProxy as a synthetic injection point and read it via getInjectedReference

Example fix

// before
SyntheticBeanBeanBuildItem.builder(MyBean.class).createWith(ctx -> new MyBeanImpl(ctx))
// after
SyntheticBeanBeanBuildItem.builder(MyBean.class)
    .injectInterceptionProxy()
    .createWith(ctx -> new MyBeanImpl(ctx.getInterceptionProxy()))
Defensive patterns

Strategy: validation

Validate before calling

// build time: ensure proxy is declared on the SyntheticBeanBuildItem
// .injectInterceptionProxy()
// runtime guard:
boolean hasProxy = ctx.getInjectedReferences().keySet().stream()
    .anyMatch(tq -> tq.getRequiredType().getTypeName().startsWith(InterceptionProxy.class.getName()));

Try / catch

try { return ctx.getInterceptionProxy(); }
catch (IllegalArgumentException e) { throw new IllegalStateException("Add .injectInterceptionProxy() to the SyntheticBeanBuildItem", e); }

Prevention

When it happens

Trigger: Inside a synthetic bean's create() function, calling creationalContext.getInterceptionProxy() without first having called injectInterceptionProxy() (typically in SyntheticBeanBuildItem configuration).

Common situations: Writing a CDI extension that registers a synthetic bean needing intercepted method calls but forgetting the interception proxy wiring; copying a synthetic bean example and omitting the proxy injection step.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/d7511b944b69d984. Report an issue: GitHub.