{"record":{"id":"16d3e1e3bb58c29e","repo":"quarkusio/quarkus","slug":"cannot-display-routefunction-on-not-found-page-a-16d3e1","errorCode":null,"errorMessage":"Cannot display <routeFunction> on not found page as no explicit path was specified and a route function is in use","messagePattern":"Cannot display <routeFunction> on not found page as no explicit path was specified and a route function is in use","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/RouteBuildItem.java","lineNumber":280,"sourceCode":"            if (routeConfigKey == null) {\n                return null;\n            }\n            if (routePath == null) {\n                throw new RuntimeException(\"Cannot discover value of \" + routeConfigKey\n                        + \" as no explicit path was specified and a route function is in use\");\n            }\n            if (absolutePath != null) {\n                return new ConfiguredPathInfo(routeConfigKey, absolutePath, true, isManagement);\n            }\n            return new ConfiguredPathInfo(routeConfigKey, routePath, false, isManagement);\n        }\n\n        protected NotFoundPageDisplayableEndpointBuildItem getNotFoundEndpoint() {\n            if (!displayOnNotFoundPage) {\n                return null;\n            }\n            if (notFoundPagePath == null) {\n                throw new RuntimeException(\"Cannot display \" + routeFunction\n                        + \" on not found page as no explicit path was specified and a route function is in use\");\n            }\n            if (absolutePath != null) {\n                return new NotFoundPageDisplayableEndpointBuildItem(absolutePath, notFoundPageTitle, true);\n            }\n            return new NotFoundPageDisplayableEndpointBuildItem(notFoundPagePath, notFoundPageTitle, false);\n        }\n    }\n}\n","sourceCodeStart":262,"sourceCodeEnd":290,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/RouteBuildItem.java#L262-L290","documentation":"Identical contract to the NonApplicationRootPathBuildItem variant: displayOnNotFoundPage requires a linkable path. RouteBuildItem.getNotFoundEndpoint throws when displayOnNotFoundPage is true but notFoundPagePath is null — i.e. the route was registered purely as a function with no explicit path to render on the 404 page. The routeFunction is stringified into the message only for diagnostics.","triggerScenarios":"RouteBuildItem.Builder with displayOnNotFoundPage(true) and no notFoundPagePath/routePath (route registered via routeFunction), then getNotFoundEndpoint() is called during the not-found-page build step.","commonSituations":"Dev-mode endpoints (e.g. Dev UI routes) marked for display on the 404 page but defined with Consumer<Route> handlers; migrating from path-based to function-based route registration.","solutions":["Call notFoundPagePath(\"/your/path\") on the builder so the 404 page can link to it","Remove displayOnNotFoundPage(true) if the endpoint cannot have a static path","Register with a path-aware method (route(configKey, path)) instead of the bare function"],"exampleFix":"// before\nnew RouteBuildItem.Builder().routeFunction(\"/q/x\", r -> r.handler(h)).displayOnNotFoundPage(true);\n// after\nnew RouteBuildItem.Builder().routeFunction(\"/q/x\", r -> r.handler(h))\n    .displayOnNotFoundPage(true).notFoundPagePath(\"/q/x\");","handlingStrategy":"validation","validationCode":"if (displayOnNotFoundPage && notFoundPagePath == null) {\n    throw new IllegalArgumentException(\"displayOnNotFoundPage(true) requires notFoundPagePath\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always call notFoundPagePath(path) together with displayOnNotFoundPage(true)","Audit builder chains that register handlers via Consumer<Route> for a companion explicit path","Wrap builder construction in a helper that enforces the path+display pairing"],"tags":["quarkus","vertx-http","not-found-page","routing","build-time"],"backgroundTag":"missing-explicit-path","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"}