quarkusio/quarkus · error · java.lang.IllegalArgumentException

A synthetic injection point was not declared for required ty

Error message

A synthetic injection point was not declared for required type [${requiredType} and qualifiers: ${qualifiers}

What it means

SyntheticCreationalContextImpl.getReference() (used by getInjectedReference) looks up a previously declared synthetic injection point by required type and qualifiers. If no such reference was injected into the synthetic bean, it throws this IllegalArgumentException. Synthetic beans must declare every injection point they intend to consume at build time.

Source

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

    @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 {

        private final Type requiredType;
        private final Annotation[] qualifiers;

        public TypeAndQualifiers(Type requiredType, Annotation[] qualifiers) {
            this.requiredType = Objects.requireNonNull(requiredType);
            this.qualifiers = qualifiers == null ? new Annotation[] { Default.Literal.INSTANCE } : qualifiers;
        }

        @Override
        public int hashCode() {
            final int prime = 31;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Declare the injection point on the SyntheticBeanBuildItem (e.g. .addInjectionPoint(TypeAndQualifiers)) before building
  2. Match the required type exactly (including generics) and qualifiers used in getInjectedReference
  3. Remember qualifiers default to @Default when none are passed — declare accordingly
  4. Check for typos in qualifier values such as @Named strings

Example fix

// before
SyntheticBeanBeanBuildItem.builder(Bean.class).createWith(ctx -> new Impl(ctx.getInjectedReference(Greet.class)))
// after
SyntheticBeanBeanBuildItem.builder(Bean.class)
    .addInjectionPoint(new TypeAndQualifiers(Greet.class))
    .createWith(ctx -> new Impl(ctx.getInjectedReference(Greet.class)))
Defensive patterns

Strategy: validation

Validate before calling

// declare at build time:
// .addInjectionPoint(new TypeAndQualifiers(requiredType, qualifiers))
// runtime pre-check via a try of the lookup is not offered; instead declare deterministically

Try / catch

try { return ctx.getInjectedReference(Type.class, quals); }
catch (IllegalArgumentException e) { throw new IllegalStateException("Declare this injection point on the SyntheticBeanBuildItem: " + e.getMessage(), e); }

Prevention

When it happens

Trigger: Calling creationalContext.getInjectedReference(SomeType.class, qualifiers...) inside a synthetic bean's create() when SomeType with those qualifiers was never declared via addInjectionPoint (or equivalent) on the SyntheticBeanBuildItem.

Common situations: Quarkifier extension authors adding a new dependency to a synthetic bean but forgetting to add the matching injection point declaration; qualifier mismatch (e.g. missing @Named value or missing @Default handling); type mismatch due to generics/boxed types.

Related errors


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