{"record":{"id":"bb3af33ca2d74876","repo":"quarkusio/quarkus","slug":"route-method-that-returns-void-must-accept-at-leas","errorCode":null,"errorMessage":"Route method that returns void must accept at least one injectable parameter [method: %s, bean: %s]","messagePattern":"Route method that returns void must accept at least one injectable parameter \\[method: (.+?), bean: (.+?)\\]","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/reactive-routes/deployment/src/main/java/io/quarkus/vertx/web/deployment/ReactiveRoutesProcessor.java","lineNumber":535,"sourceCode":"        if (!method.returnType().kind().equals(Type.Kind.VOID)) {\n            throw new IllegalStateException(\n                    String.format(\"Route filter method must return void [method: %s, bean: %s]\", method, bean));\n        }\n        List<Type> params = method.parameterTypes();\n        if (params.size() != 1 || !params.get(0).name()\n                .equals(DotNames.ROUTING_CONTEXT)) {\n            throw new IllegalStateException(String.format(\n                    \"Route filter method must accept exactly one parameter of type %s: %s [method: %s, bean: %s]\",\n                    DotNames.ROUTING_CONTEXT, params, method, bean));\n        }\n    }\n\n    private void validateRouteMethod(BeanInfo bean, MethodInfo method,\n            TransformedAnnotationsBuildItem transformedAnnotations, IndexView index, AnnotationInstance routeAnnotation) {\n        List<Type> params = method.parameterTypes();\n        if (params.isEmpty()) {\n            if (method.returnType().kind() == Kind.VOID && params.isEmpty()) {\n                throw new IllegalStateException(String.format(\n                        \"Route method that returns void must accept at least one injectable parameter [method: %s, bean: %s]\",\n                        method, bean));\n            }\n        } else {\n            AnnotationValue typeValue = routeAnnotation.value(VALUE_TYPE);\n            Route.HandlerType handlerType = typeValue == null\n                    ? Route.HandlerType.NORMAL\n                    : Route.HandlerType.from(typeValue.asEnum());\n\n            DotName returnTypeName = method.returnType().name();\n\n            if ((returnTypeName.equals(DotNames.UNI)\n                    || returnTypeName.equals(DotNames.MULTI)\n                    || returnTypeName.equals(DotNames.COMPLETION_STAGE))\n                    && method.returnType().kind() == Kind.CLASS) {\n                throw new IllegalStateException(String.format(\n                        \"Route business method returning a Uni/Multi/CompletionStage must declare a type argument on the return type [method: %s, bean: %s]\",\n                        method, bean));","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/reactive-routes/deployment/src/main/java/io/quarkus/vertx/web/deployment/ReactiveRoutesProcessor.java#L517-L553","documentation":"Raised by ReactiveRoutesProcessor.validateRouteMethod when a @Route-annotated business method returns void but declares no parameters the framework can inject. A void route method cannot produce a response body, so it must either end the response itself via an injectable parameter (e.g. RoutingContext) or otherwise consume the request; the surrounding validation walks the method signature (params.isEmpty() with VOID return) and rejects methods that could neither reply nor observe anything.","triggerScenarios":"Thrown at extensions/reactive-routes/deployment/src/main/java/io/quarkus/vertx/web/deployment/ReactiveRoutesProcessor.java:535 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add an injectable parameter such as io.vertx.ext.web.RoutingContext to the route method so it can end the response","Return a value (e.g. String, Uni<String>) from the method instead of void","Annotate the method as a filter-style handler correctly (@Route with proper handler type) if that was intended"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}