{"record":{"id":"9b365df0e26b7b75","repo":"flarum/framework","slug":"routenotfoundexception-uri","errorCode":null,"errorMessage":"RouteNotFoundException ($uri)","messagePattern":"RouteNotFoundException \\(\\$uri\\)","errorType":"http","errorClass":"RouteNotFoundException","httpStatus":404,"severity":"error","filePath":"framework/core/src/Http/Middleware/ResolveRoute.php","lineNumber":50,"sourceCode":"     *\n     * @throws MethodNotAllowedException\n     * @throws RouteNotFoundException\n     */\n    public function process(Request $request, Handler $handler): Response\n    {\n        $method = $request->getMethod();\n        $uri = $request->getUri()->getPath() ?: '/';\n\n        // Strip trailing slash so that e.g. /d/123-slug/ resolves the same as /d/123-slug.\n        if ($uri !== '/' && str_ends_with($uri, '/')) {\n            $uri = rtrim($uri, '/');\n        }\n\n        $routeInfo = $this->getDispatcher()->dispatch($method, $uri);\n\n        switch ($routeInfo[0]) {\n            case Dispatcher::NOT_FOUND:\n                throw new RouteNotFoundException($uri);\n            case Dispatcher::METHOD_NOT_ALLOWED:\n                throw new MethodNotAllowedException($method);\n            default:\n                $request = $request\n                    ->withAttribute('routeName', $routeInfo[1]['name'])\n                    ->withAttribute('routeHandler', $routeInfo[1]['handler'])\n                    ->withAttribute('routeParameters', $routeInfo[2]);\n\n                return $handler->handle($request);\n        }\n    }\n\n    protected function getDispatcher(): Dispatcher\\GroupCountBased\n    {\n        if (! isset($this->dispatcher)) {\n            $this->dispatcher = new Dispatcher\\GroupCountBased($this->routes->getRouteData());\n        }\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/flarum/framework/blob/4b939f685389bfe8a380e9e28ddf305a1c66950c/framework/core/src/Http/Middleware/ResolveRoute.php#L32-L68","documentation":"Thrown in ResolveRoute::process when FastRoute's dispatcher returns NOT_FOUND for the request method + URI: no registered route matches the path (after trailing-slash stripping). This is the middleware-level signal that the client requested a nonexistent endpoint; it surfaces as a 404. It is a routing sentinel for unmatched URLs, not a handler error.","triggerScenarios":"Thrown at framework/core/src/Http/Middleware/ResolveRoute.php:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the request path for typos and confirm the endpoint exists","Register a route for the path if it is a new endpoint (Extend\\Routes)","If a frontend link leads here, the route it was generated from may be stale or removed by a disabled extension"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4b939f685389bfe8a380e9e28ddf305a1c66950c","analyzedAt":"2026-09-15T18:09:20.879Z","contentChangedAt":"2026-09-15T18:09:20.879Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}