{"record":{"id":"e8995f8f4b840a92","repo":"quarkusio/quarkus","slug":"invalid-target-for-the-registerinterceptor-tar","errorCode":null,"errorMessage":"Invalid target for the @RegisterInterceptor: ${target}","messagePattern":"Invalid target for the @RegisterInterceptor: (.+?)","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcServerProcessor.java","lineNumber":831,"sourceCode":"        superfluousInterceptors.remove(RoutingContextGrpcInterceptor.class.getName());\n\n        // Remove the metrics interceptors\n        for (String mi : MICROMETER_INTERCEPTORS) {\n            superfluousInterceptors.remove(mi);\n        }\n\n        List<AnnotationInstance> found = new ArrayList<>(index.getAnnotations(GrpcDotNames.REGISTER_INTERCEPTOR));\n        for (AnnotationInstance annotation : index.getAnnotations(GrpcDotNames.REGISTER_INTERCEPTORS)) {\n            for (AnnotationInstance nested : annotation.value().asNestedArray()) {\n                found.add(AnnotationInstance.create(nested.name(), annotation.target(), nested.values()));\n            }\n        }\n\n        Map<String, Set<String>> registeredInterceptors = new LinkedHashMap<>();\n        for (AnnotationInstance annotation : found) {\n            String interceptorClass = annotation.value().asString();\n            if (annotation.target().kind() != Kind.CLASS) {\n                throw new IllegalStateException(\"Invalid target for the @RegisterInterceptor: \" + annotation.target());\n            }\n            String targetClass = annotation.target().asClass().name().toString();\n\n            // if the user bean is invoked by a generated bean\n            // the interceptors defined on the user bean have to be applied to the generated bean:\n            targetClass = delegateMap.getOrDefault(targetClass, targetClass);\n\n            Set<String> registered = registeredInterceptors.computeIfAbsent(targetClass, k -> new LinkedHashSet<>());\n            registered.add(interceptorClass);\n            superfluousInterceptors.remove(interceptorClass);\n        }\n\n        Set<Class<?>> globalInterceptors = new LinkedHashSet<>();\n        for (String interceptor : interceptors.globalInterceptors.stream().sorted().toList()) {\n            reflectiveClassBuildItemBuildProducer\n                    .produce(ReflectiveClassBuildItem.builder(interceptor).constructors(false).build());\n            globalInterceptors.add(recorderContext.classProxy(interceptor));\n        }","sourceCodeStart":813,"sourceCodeEnd":849,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcServerProcessor.java#L813-L849","documentation":"@RegisterInterceptor must be placed on a class (the user bean class whose interceptors should apply to generated gRPC beans). If an annotation instance targets anything other than a class, deployment fails.","triggerScenarios":"An @RegisterInterceptor annotation instance found during GrpcServerProcessor.execute whose target().kind() != CLASS — e.g. placed on a method or field instead of the bean class.","commonSituations":"Misreading the annotation's purpose and attaching it to interceptor methods; code generators misplacing it; copy-paste from @Interceptor conventions.","solutions":["Move @RegisterInterceptor to the gRPC service/bean class: @RegisterInterceptor(MyInterceptor.class) on the class","Ensure the interceptor class itself is a proper gRPC interceptor","Fix any tooling that relocates the annotation"],"exampleFix":"// before\nclass GreeterService {\n    @RegisterInterceptor(AuthInterceptor.class)\n    public void greet(...) { ... }\n}\n\n// after\n@RegisterInterceptor(AuthInterceptor.class)\nclass GreeterService {\n    public void greet(...) { ... }\n}","handlingStrategy":"validation","validationCode":"// @RegisterInterceptor goes on the class\n@RegisterInterceptor(AuthInterceptor.class)\npublic class GreeterService { ... }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check @Target before using an annotation","Place interceptor registration on the bean class, not methods","Review gRPC interceptor docs for the correct registration pattern"],"tags":["grpc","interceptor","annotation-misuse"],"backgroundTag":"invalid-annotation-target","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}