{"record":{"id":"728c84eb19e22d4e","repo":"quarkusio/quarkus","slug":"an-event-consumer-business-method-that-accepts-io","errorCode":null,"errorMessage":"An event consumer business method that accepts io.vertx.core.eventbus.Message or io.vertx.mutiny.core.eventbus.Message must return void [method: %s, bean:%s]","messagePattern":"An event consumer business method that accepts io\\.vertx\\.core\\.eventbus\\.Message or io\\.vertx\\.mutiny\\.core\\.eventbus\\.Message must return void \\[method: (.+?), bean:(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java","lineNumber":190,"sourceCode":"                    if (parametersCount == 2) {\n                        if (!isMessageHeaders(params.get(0).name())) {\n                            // If there are two parameters, the first must be message headers.\n                            throw new IllegalStateException(String.format(\n                                    \"An event consumer business method with two parameters must have MultiMap as the first parameter: %s [method: %s, bean:%s]\",\n                                    params, method, bean));\n                        } else if (isMessage(params.get(1).name())) {\n                            throw new IllegalStateException(String.format(\n                                    \"An event consumer business method with two parameters must not accept io.vertx.core.eventbus.Message or io.vertx.mutiny.core.eventbus.Message: %s [method: %s, bean:%s]\",\n                                    params, method, bean));\n                        }\n                    } else if (parametersCount != 1) {\n                        throw new IllegalStateException(String.format(\n                                \"An event consumer business method must accept exactly one parameter: %s [method: %s, bean:%s]\",\n                                params, method, bean));\n                    }\n                    if (method.returnType().kind() != Kind.VOID && VertxConstants.isMessage(params.get(0).name())\n                            && !KotlinUtils.isKotlinSuspendMethod(method)) {\n                        throw new IllegalStateException(String.format(\n                                \"An event consumer business method that accepts io.vertx.core.eventbus.Message or io.vertx.mutiny.core.eventbus.Message must return void [method: %s, bean:%s]\",\n                                method, bean));\n                    }\n                    if (method.hasAnnotation(RunOnVirtualThread.class) && consumeEvent.value(\"ordered\") != null\n                            && consumeEvent.value(\"ordered\").asBoolean()) {\n                        throw new IllegalStateException(String.format(\n                                \"An event consumer business method that cannot use @RunOnVirtualThread and set the ordered attribute to true [method: %s, bean:%s]\",\n                                method, bean));\n                    }\n\n                    InvokerBuilder builder = invokerFactory.createInvoker(bean, method)\n                            .withInstanceLookup();\n\n                    if (parametersCount == 1 && method.parameterType(0).name().equals(MESSAGE)) {\n                        // io.vertx.core.eventbus.Message\n                        // no transformation required\n                    } else if (parametersCount == 1 && method.parameterType(0).name().equals(MUTINY_MESSAGE)) {\n                        // io.vertx.mutiny.core.eventbus.Message","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java#L172-L208","documentation":"When a @ConsumeEvent method consumes the full io.vertx.core.eventbus.Message (or Mutiny Message) instead of just the payload, Quarkus requires it to return void. Message-consuming methods handle replies themselves via message.reply(); a non-void return type is ambiguous and rejected at build time.","triggerScenarios":"A @ConsumeEvent method whose sole parameter is Message/Mutiny Message and whose return type is not void (e.g. returns String, Uni, or a payload object). Kotlin suspend methods are exempt.","commonSituations":"Migrating a payload-style consumer to Message style but keeping the return value; copying a payload consumer signature and swapping the parameter to Message; auto-complete generating a reply-returning method.","solutions":["Make the method return void and reply explicitly with message.reply(...)/message.fail(...)","If you want to return a value, consume the raw payload instead of Message and let the returned object be the reply","Convert to Uni<Void>/CompletionStage<Void> only via a payload-style method if async processing is needed","For Kotlin, keep the method suspend — it is allowed despite non-void semantics"],"exampleFix":"// before\n@ConsumeEvent(\"greeting\")\nString consume(Message<String> msg) { return \"hi\"; }\n\n// after\n@ConsumeEvent(\"greeting\")\nvoid consume(Message<String> msg) { msg.reply(\"hi\"); }","handlingStrategy":"validation","validationCode":"if ((param instanceof io.vertx.core.eventbus.Message\n     || param instanceof io.vertx.mutiny.core.eventbus.Message)\n    && method.getReturnType() != void.class) {\n    throw new IllegalStateException(\"Message-consuming @ConsumeEvent methods must return void: \" + method);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Return void when consuming Message; reply via msg.reply()/fail()","Reserve return values for payload-style consumers","Remember Kotlin suspend methods are exempt from this rule","Grep for '@ConsumeEvent' methods returning non-void with Message params in CI"],"tags":["quarkus","vertx","eventbus","message-codec","build-time-validation"],"backgroundTag":"invalid-event-consumer-signature","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}