quarkusio/quarkus · error · RuntimeException

Cannot discover value of <routeConfigKey> as no explicit pat

Error message

Cannot discover value of <routeConfigKey> as no explicit path was specified and a route function is in use

What it means

getRouteConfigInfo resolves the final configured path for a route keyed by routeConfigKey (e.g. quarkus.http.non-application-root-path entries). If the builder only has a route function and no explicit routePath, there is nothing to report for that config key, so it throws instead of returning a misleading ConfiguredPathInfo. This happens during deployment when other parts of the build need to know where a route ended up.

Source

Thrown at extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/RouteBuildItem.java:266

        private boolean shouldInclude(String managementConfigKey) {
            Config config = ConfigProvider.getConfig();
            return config.getValue(managementConfigKey, boolean.class);
        }

        public RouteBuildItem build() {
            if (routeFunction == null) {
                throw new IllegalStateException(
                        "'RouteBuildItem$Builder.routeFunction' was not set. Ensure that one of the builder methods that result in it being set is called");
            }
            return new RouteBuildItem(this, APPLICATION_ROUTE, APPLICATION_ROUTE, isManagement);
        }

        protected ConfiguredPathInfo getRouteConfigInfo() {
            if (routeConfigKey == null) {
                return null;
            }
            if (routePath == null) {
                throw new RuntimeException("Cannot discover value of " + routeConfigKey
                        + " as no explicit path was specified and a route function is in use");
            }
            if (absolutePath != null) {
                return new ConfiguredPathInfo(routeConfigKey, absolutePath, true, isManagement);
            }
            return new ConfiguredPathInfo(routeConfigKey, routePath, false, isManagement);
        }

        protected NotFoundPageDisplayableEndpointBuildItem getNotFoundEndpoint() {
            if (!displayOnNotFoundPage) {
                return null;
            }
            if (notFoundPagePath == null) {
                throw new RuntimeException("Cannot display " + routeFunction
                        + " on not found page as no explicit path was specified and a route function is in use");
            }
            if (absolutePath != null) {
                return new NotFoundPageDisplayableEndpointBuildItem(absolutePath, notFoundPageTitle, true);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set an explicit path (route(String configKey, String path) or routeFunction(String path, Consumer<Route>)) so the config key has a resolvable value
  2. Drop the routeConfigKey if the route truly has no configurable path
  3. Verify the builder method used populates routePath: path-based overloads do, Consumer-only chain does not

Example fix

// before
new RouteBuildItem.Builder().routeFunction("/q/foo", r -> r.handler(h))
    .routeConfigKey("quarkus.smallrye-graphql.root-path");
// after
new RouteBuildItem.Builder().route("quarkus.smallrye-graphql.root-path", "/graphql")
    .routeFunction(r -> r.handler(h));
Defensive patterns

Strategy: validation

Validate before calling

if (configKey != null) {
    if (routePath == null) {
        throw new IllegalArgumentException("routeConfigKey " + configKey + " requires an explicit path");
    }
}

Prevention

When it happens

Trigger: Building a RouteBuildItem with routeConfigKey set (or a path-backed route query) but registering the handler via a route function without routePath/notFoundPagePath, then getRouteConfigInfo() is invoked by the VertxHttpProcessor during aggregation.

Common situations: Extension authors setting a config key expecting Quarkus to derive the path, but registering via routeFunction(Consumer) overload; renaming path config properties so routePath no longer gets populated.

Related errors


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