quarkusio/quarkus · error · IllegalStateException

Route method that returns void must accept at least one para

Error message

Route method that returns void must accept at least one parameter that can end the response [method: %s, bean: %s]

What it means

Raised by ReactiveRoutesProcessor.validateRouteMethod after the parameter loop when a void route method has no parameter whose injector can end the response. The processor tracks canEndResponse across all matched injectors (RoutingContext and body writers set it); a void method without any such parameter would return without ever replying to the client, leaving requests hanging, so validation rejects the signature at build time.

Source

Thrown at extensions/reactive-routes/deployment/src/main/java/io/quarkus/vertx/web/deployment/ReactiveRoutesProcessor.java:593

                            "HandlerType.%s is not legal for parameter %s of route method %s declared on %s",
                            injector.getTargetHandlerType(), idx, method, bean));
                }

                // A param injector may validate the parameter annotations
                injector.validate(bean, method, routeAnnotation, paramType, paramAnnotations);

                if (injector.canEndResponse) {
                    canEndResponse = true;
                }

                if (Route.HandlerType.FAILURE == handlerType && isThrowable(paramType, index)) {
                    failureParams++;
                }
                idx++;
            }

            if (method.returnType().kind() == Kind.VOID && !canEndResponse) {
                throw new IllegalStateException(String.format(
                        "Route method that returns void must accept at least one parameter that can end the response [method: %s, bean: %s]",
                        method, bean));
            }

            if (failureParams > 1) {
                throw new IllegalStateException(String.format(
                        "A failure handler may only define one failure parameter - route method %s declared on %s",
                        method, bean));
            }
        }
    }

    private String generateHandler(HandlerDescriptor desc, BeanInfo bean, MethodInfo method, Gizmo gizmo,
            TransformedAnnotationsBuildItem transformedAnnotations, AnnotationInstance routeAnnotation,
            BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy, String defaultProduces,
            boolean validatorAvailable, IndexView index) {

        if (desc.requireValidation() && !validatorAvailable) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add a parameter that can end the response, such as RoutingContext, and call response.end()
  2. Return a value from the method instead of declaring it void
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extensions/reactive-routes/deployment/src/main/java/io/quarkus/vertx/web/deployment/ReactiveRoutesProcessor.java:593 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/30806ea97ece839f. Report an issue: GitHub.