quarkusio/quarkus · error · RuntimeException
This method is not supported using this builder. Use #routeF
Error message
This method is not supported using this builder. Use #routeFunction(String, Consumer<Route>)
What it means
NonApplicationRootPathBuildItem.Builder intentionally rejects the generic routeFunction(Function<Router,Route>) overload because the framework needs an explicit path string to compute the final non-application route. The builder throws unconditionally in this overload to steer callers toward the path-aware routeFunction(String, Consumer<Route>) variant. This is a compile-time-avoidable but runtime-enforced API contract within the Quarkus build-time framework.
Source
Thrown at extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/NonApplicationRootPathBuildItem.java:282
}
/**
* Per non-application endpoint instance.
*/
public static class Builder extends RouteBuildItem.Builder {
private final NonApplicationRootPathBuildItem buildItem;
private RouteBuildItem.RouteType routeType = RouteBuildItem.RouteType.FRAMEWORK_ROUTE;
private RouteBuildItem.RouteType routerType = RouteBuildItem.RouteType.FRAMEWORK_ROUTE;
private String name;
private String path;
Builder(NonApplicationRootPathBuildItem buildItem) {
this.buildItem = buildItem;
}
@Override
public Builder routeFunction(Function<Router, Route> routeFunction) {
throw new RuntimeException(
"This method is not supported using this builder. Use #routeFunction(String, Consumer<Route>)");
}
public Builder routeFunction(String route, Consumer<Route> routeFunction) {
return orderedRoute(route, null, routeFunction);
}
@Override
public Builder route(String route) {
routeFunction(route, null);
return this;
}
@Override
public Builder orderedRoute(String route, Integer order) {
orderedRoute(route, order, null);
return this;
}View on GitHub (pinned to e1c734241f)
Solutions
- Replace the call with routeFunction(String route, Consumer<Route>) passing an explicit path, e.g. builder.routeFunction("/my-endpoint", route -> route.handler(handler))
- If a Router-level function is required, use the Builder's orderedRoute(path, order, consumer) methods which accept paths
- Check which builder class you hold: NonApplicationRootPathBuildItem.Builder disallows the Function overload while other route builders allow it
Example fix
// before
builder.routeFunction(router -> router.route("/framework/foo").handler(handler));
// after
builder.routeFunction("/framework/foo", route -> route.handler(handler)); Defensive patterns
Strategy: validation
Validate before calling
boolean isNonAppBuilder = builder instanceof NonApplicationRootPathBuildItem.Builder;
if (isNonAppBuilder) {
// use routeFunction(String, Consumer<Route>) only
assert path != null && !path.isBlank() : "non-application routes need an explicit path";
} Type guard
boolean supportsFunctionOverload(Object builder) {
return !(builder instanceof NonApplicationRootPathBuildItem.Builder);
} Prevention
- Always pair route registration with an explicit path string on NonApplicationRootPathBuildItem.Builder
- Never copy builder chains written for application RouteBuildItem.Builder onto non-application builders
- Use the String-path overloads (routeFunction(String, Consumer<Route>), orderedRoute) exclusively for framework/console/management routes
When it happens
Trigger: Calling builder.routeFunction(Function<Router,Route>) on the Builder obtained from a NonApplicationRootPathBuildItem's Builder constructor; the throw is unconditional on that overload.
Common situations: Extension authors porting code that builds application RouteBuildItems (where the Function overload is legal) to non-application root (framework/dev console/management) routes; copy-pasting a builder chain that used the Function overload elsewhere.
Related errors
- Cannot display <routeFunction> on not found page as no expli
- 'RouteBuildItem$Builder.routeFunction' was not set. Ensure t
- Cannot discover value of <routeConfigKey> as no explicit pat
- Cannot display <routeFunction> on not found page as no expli
- Too many default routes.
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/42a67b0265c822da.
Report an issue: GitHub.