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
- Replace or complement the annotations with @GrpcClient("service-name") on the parameter
- Remove unrelated qualifiers that do not apply to gRPC clients
- 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
- Do not stack CDI qualifiers (@Named etc.) on gRPC client parameters
- Use @GrpcClient as the sole qualifier for gRPC injections
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
- A gRPC service injection is missing the @GrpcClient qualifie
- Unable to derive the service interface for the generated Mut
- Unable to determine the client name from the parameter at po
- ${clientAnnotation} may not be declared at ${target}
- Invalid @GrpcClient `${targetInfo}` - client name cannot be
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/0bfbc3a9fe444c6d.
Report an issue: GitHub.