{"record":{"id":"d8591342e62de90b","repo":"remix-run/react-router","slug":"no-handlers-were-found-for-the-request-url-path","errorCode":null,"errorMessage":"No handlers were found for the request: ${url.pathname}${url.search}","messagePattern":"No handlers were found for the request: (.+?)(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-router-dev/vite/plugin.ts","lineNumber":1720,"sourceCode":"                  (a, b) => b.matchDepth - a.matchDepth || a.index - b.index,\n                )\n                .map(({ entry }) => entry);\n            }\n\n            for (let { handler } of handlersToTry) {\n              response = await handler(request, loadContext);\n\n              if (response.status !== 404) {\n                return response;\n              }\n            }\n\n            if (response) {\n              return response;\n            }\n\n            let url = new URL(request.url);\n            throw new Error(\n              \"No handlers were found for the request: \" +\n                url.pathname +\n                url.search,\n            );\n          };\n\n          return cachedHandler;\n        }\n\n        return () => {\n          // Handle SSR requests in preview mode using the built server bundle\n          previewServer.middlewares.use(async (req, res, next) => {\n            if (\n              !ctx.reactRouterConfig.ssr &&\n              (!process.env.hasOwnProperty(\"IS_RR_BUILD_REQUEST\")\n                ? true\n                : process.env.IS_RR_BUILD_REQUEST !== \"yes\")\n            ) {","sourceCodeStart":1702,"sourceCodeEnd":1738,"githubUrl":"https://github.com/remix-run/react-router/blob/1fd704a7dabcbe3ae09d7387b460e6acaba30ec1/packages/react-router-dev/vite/plugin.ts#L1702-L1738","documentation":"Thrown by the SSR request handler used during `vite preview` (and internal prerender requests). The handler iterates candidate request handlers from the server build; if every handler returns a 404 (or returns nothing), no handler matched the request URL, and the throw surfaces the unmatched `pathname` + `search`. It is the preview-mode equivalent of an unhandled route.","triggerScenarios":"Hitting a path during `react-router preview` that is not in the route manifest (e.g. `/favicon.ico` when no route or static file serves it); a misconfigured `basename` so requests resolve against the wrong prefix; a deployed server bundle missing the route because `serverBundles` filtered it out; SPA fallback disabled and the path matches no static asset either.","commonSituations":"Previewing a prerendered build and visiting a URL that was neither prerendered nor routed; misaligned `basename` between build and preview; tooling/bots requesting `/robots.txt` or `/_health` that have no handler; `serverBundles` accidentally excludes a branch.","solutions":["Confirm the path is declared in your routes (`flatRoutes()` glob or manual `route()`).","Check `basename` in your config matches the URL prefix you are visiting.","Add a catch-all or resource route for paths external tools hit (e.g. `route(\"favicon.ico\", ...)`).","Inspect your `serverBundles` function — make sure it does not omit the branch serving this path.","If prerendering, ensure the path is listed in `prerender` or matched by a route."],"exampleFix":"// before: /favicon.ico returns \"No handlers were found\"\n// after: add a resource route\n// app/routes/favicon[.]ico.ts\nexport const loader = () =>\n  new Response(favicon, { headers: { \"content-type\": \"image/x-icon\" } });","handlingStrategy":"validation","validationCode":"// Validate a path is addressable before preview\nimport { matchRoutes } from \"react-router\";\nconst assertRoutable = (routes, pathname) => {\n  if (!matchRoutes(routes, pathname)) {\n    throw new Error(`No route matches ${pathname}`);\n  }\n};","typeGuard":null,"tryCatchPattern":"try {\n  await handler(request);\n} catch (e) {\n  if (/No handlers were found/.test(String(e.message))) {\n    // serve a custom 404 instead of crashing preview\n    return new Response(notFoundHtml, { status: 404, headers: { \"content-type\": \"text/html\" } });\n  }\n  throw e;\n}","preventionTips":["Keep a catch-all route (`route(\"*\", ...)`) for unmatched paths.","Verify `basename` matches your deployment prefix.","Add resource routes for files bots hit (`favicon.ico`, `robots.txt`)."],"tags":["preview","ssr","routing","handler","manifest"],"backgroundTag":null,"analyzedSha":"1fd704a7dabcbe3ae09d7387b460e6acaba30ec1","analyzedAt":"2026-08-12T13:54:57.804Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}