quarkusio/quarkus · error · IllegalStateException

A gRPC service injection is missing the @GrpcClient qualifie

Error message

A gRPC service injection is missing the @GrpcClient qualifier: ${class}#${method}()

What it means

A CDI initializer method parameter of a gRPC service interface type has multiple annotations but none is the @GrpcClient qualifier (the code counts parameter annotations and throws when >1 without a matching qualifier at that position). The injection cannot be resolved without the qualifier.

Source

Thrown at extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcClientProcessor.java:340

                            + field.declaringClass().name() + "#" + field.name());
                }
            } else if (injectAnnotation.target().kind() == Kind.METHOD) {
                // CDI initializer
                MethodInfo method = injectAnnotation.target().asMethod();
                short position = 0;
                for (Type param : method.parameterTypes()) {
                    position++;
                    if (serviceInterfaces.contains(param.name())) {
                        // e.g. @Inject void setGreeter(Greeter greeter)
                        Set<AnnotationInstance> annotations = new HashSet<>();
                        for (AnnotationInstance annotation : method.annotations()) {
                            if (annotation.target().kind() == Kind.METHOD_PARAMETER
                                    && annotation.target().asMethodParameter().position() == position) {
                                annotations.add(annotation);
                            }
                        }
                        if (annotations.size() > 1) {
                            throw new IllegalStateException("A gRPC service injection is missing the @GrpcClient qualifier: "
                                    + method.declaringClass().name() + "#" + method.name() + "()");
                        }
                    }
                }
            }
        }
    }

    @BuildStep
    InjectionPointTransformerBuildItem transformInjectionPoints() {
        return new InjectionPointTransformerBuildItem(new InjectionPointsTransformer() {

            @Override
            public void transform(TransformationContext ctx) {
                // If annotated with @GrpcClient and no explicit value is used, i.e. @GrpcClient(),
                // then we need to determine the service name from the annotated element and transform the injection point
                AnnotationInstance clientAnnotation = Annotations.find(ctx.getQualifiers(), GrpcDotNames.GRPC_CLIENT);
                if (clientAnnotation != null && clientAnnotation.value() == null) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Replace or complement the annotations with @GrpcClient("service-name") on the parameter
  2. Remove unrelated qualifiers that do not apply to gRPC clients
  3. Move to field injection with @Inject @GrpcClient

Example fix

// before
@Inject void init(@Named("g") Greeter greeter) { ... }

// after
@Inject void init(@GrpcClient("hello-service") Greeter greeter) { ... }
Defensive patterns

Strategy: validation

Validate before calling

@Inject
void init(@GrpcClient("hello-service") Greeter greeter) { ... } // explicit qualifier at parameter

Prevention

When it happens

Trigger: A method parameter of type <service interface> carries annotations (e.g. @Sized, @Default or others) with size > 1 but no @GrpcClient at that parameter position, while the method itself is @Inject.

Common situations: Adding arbitrary qualifier annotations (@Named, custom qualifiers) to gRPC injection parameters; confusion between CDI qualifiers and @GrpcClient; copy-paste of annotated method signatures.

Related errors


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