{"record":{"id":"f39b92a1cb27897e","repo":"quarkusio/quarkus","slug":"invalid-codec-argument-in-consumeevent-no-par","errorCode":null,"errorMessage":"Invalid `codec` argument in @ConsumeEvent - no parameter","messagePattern":"Invalid `codec` argument in @ConsumeEvent - no parameter","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/EventBusCodecProcessor.java","lineNumber":73,"sourceCode":"\n        final IndexView index = beanArchiveIndexBuildItem.getIndex();\n        Collection<AnnotationInstance> consumeEventAnnotationInstances = index.getAnnotations(CONSUME_EVENT);\n        Map<DotName, DotName> codecByTypes = new HashMap<>();\n        Set<DotName> selectorTypes = new HashSet<>();\n\n        for (AnnotationInstance consumeEventAnnotationInstance : consumeEventAnnotationInstances) {\n            AnnotationTarget typeTarget = consumeEventAnnotationInstance.target();\n            if (typeTarget.kind() != AnnotationTarget.Kind.METHOD) {\n                throw new IllegalStateException(\"@ConsumeEvent annotation must target a method\");\n            }\n            MethodInfo method = typeTarget.asMethod();\n\n            Type codecTargetFromParameter = extractPayloadTypeFromParameter(method);\n            // If the @ConsumeEvent set the codec, use this codec. It applies to the parameter\n            AnnotationValue codec = consumeEventAnnotationInstance.value(\"codec\");\n            if (codec != null && codec.asClass().kind() == Type.Kind.CLASS) {\n                if (codecTargetFromParameter == null) {\n                    throw new IllegalStateException(\"Invalid `codec` argument in @ConsumeEvent - no parameter\");\n                }\n                codecByTypes.put(codecTargetFromParameter.name(), codec.asClass().asClassType().name());\n            } else if (codecTargetFromParameter != null && !hasBuiltInCodec(codecTargetFromParameter)) {\n                // Codec is not set and built-in codecs cannot be used\n                if (!codecByTypes.containsKey(codecTargetFromParameter.name())) {\n                    if (isConcreteClass(codecTargetFromParameter, index)) {\n                        // The default codec makes only sense for concrete classes\n                        LOGGER.debugf(\"Local Message Codec registered for type %s\",\n                                codecTargetFromParameter);\n                        codecByTypes.put(codecTargetFromParameter.name(), LOCAL_EVENT_BUS_CODEC);\n                    } else {\n                        LOGGER.debugf(\"Local Message Codec will be selected for type %s\", codecTargetFromParameter);\n                        selectorTypes.add(codecTargetFromParameter.name());\n                    }\n                }\n            }\n\n            Type codecTargetFromReturnType = extractPayloadTypeFromReturn(method);","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/EventBusCodecProcessor.java#L55-L91","documentation":"When @ConsumeEvent(codec = SomeCodec.class) is used, the consumer method must have at least one parameter that identifies the payload type the codec applies to. If the method has no parameter to infer a payload type from, the build fails with this IllegalStateException.","triggerScenarios":"Annotating a codec-bearing @ConsumeEvent on a zero-parameter method; a method whose parameters are all unannotated primitives/generics that yield no payload type.","commonSituations":"Refactoring a consumer to take no argument while keeping the codec; typo making the payload type invisible to the annotation processor (raw generic parameter).","solutions":["Give the consumer method a parameter matching the codec's payload type","Remove the codec attribute if the method intentionally consumes no payload","Use the Message<T> parameter form so the payload type is explicit"],"exampleFix":"// before\n@ConsumeEvent(value = \"addr\", codec = MyCodec.class)\npublic void onEvent() { }\n// after\n@ConsumeEvent(value = \"addr\", codec = MyCodec.class)\npublic void onEvent(MyPayload payload) { }","handlingStrategy":"validation","validationCode":"// codec consumers must have a payload parameter\nMethod m = MyConsumer.class.getDeclaredMethod(\"on\");\nif (m.isAnnotationPresent(ConsumeEvent.class)\n    && m.getAnnotation(ConsumeEvent.class).codec() != Object.class\n    && m.getParameterCount() == 0) {\n    throw new IllegalStateException(\"codec requires a payload parameter\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use codec= with a parameterized consumer method","Keep codec payload type aligned with the method parameter","Review consumer signatures in code review"],"tags":["quarkus","vertx","event-bus","codec","build-time"],"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"}