{"record":{"id":"b08abf2376273f28","repo":"remix-run/react-router","slug":"unable-to-prerender-path-because-it-does-not-match","errorCode":null,"errorMessage":"Unable to prerender path because it does not match any routes: ${path}","messagePattern":"Unable to prerender path because it does not match any routes: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/react-router-dev/vite/plugin.ts","lineNumber":3782,"sourceCode":"  return arr as unknown[] as AsyncFlatten<T>;\n}\n\ntype PrerenderMetadata = {\n  type: \"data\" | \"resource\" | \"html\" | \"spa\";\n  path: string;\n  isResourceRoute?: boolean;\n};\n\nfunction assertPrerenderPathsMatchRoutes(\n  config: ResolvedReactRouterConfig,\n  prerenderPaths: string[],\n): void {\n  let routes = createPrerenderRoutes(config.routes);\n\n  for (let path of prerenderPaths) {\n    let matches = matchRoutes(routes, `/${path}/`.replace(/^\\/\\/+/, \"/\"));\n    if (!matches) {\n      throw new Error(\n        `Unable to prerender path because it does not match any routes: ${path}`,\n      );\n    }\n  }\n}\n\nfunction getPrerenderConcurrencyConfig(\n  reactRouterConfig: ResolvedReactRouterConfig,\n): number {\n  let concurrency = 1;\n  let { prerender } = reactRouterConfig;\n  if (typeof prerender === \"object\" && \"concurrency\" in prerender) {\n    concurrency = prerender.concurrency ?? 1;\n  }\n  return concurrency;\n}\n\nfunction createDataRequest(","sourceCodeStart":3764,"sourceCodeEnd":3800,"githubUrl":"https://github.com/remix-run/react-router/blob/6beaca39526d5716c3c112ebb0782765baa5a9ce/packages/react-router-dev/vite/plugin.ts#L3764-L3800","documentation":"Before prerendering, React Router builds a route matcher from the config and asserts every requested path matches at least one route (`/${path}/` with leading-slash normalization). A path that matches nothing means the static file would be unreachable dead output, so the build fails with the offending path named. This validation runs for explicitly listed and generated prerender paths.","triggerScenarios":"`prerender: ['/about-us']` when the route is `/about` (typo or rename); paths returned by `getStaticPaths()` or a custom `prerender` function that no longer correspond to routes after a route refactor; index-route confusion (`/blog` vs `/blog/`) where normalization still finds no match; splat params misspelled.","commonSituations":"CMS-driven path lists drifting out of sync with routes; renaming routes without updating a hardcoded prerender array; copying path lists between projects.","solutions":["Fix the path in the `prerender` config to match the actual route pattern (check app/routes.ts / file naming)","If paths come from `getStaticPaths()` or a CMS, filter them against known route patterns before returning","Add the missing route if the path is supposed to exist","Remember paths are matched without origin and with trailing-slash normalization — omit the domain and leading duplication"],"exampleFix":"// before (react-router.config.ts) — '/about-us' route doesn't exist\nexport default { prerender: ['/about-us'] };\n\n// after\nexport default { prerender: ['/about'] };","handlingStrategy":"validation","validationCode":"// Validate prerender paths against the route config before building\nimport { matchRoutes } from 'react-router';\nimport routes from './app/routes'; // RouteConfig objects\nconst valid = PRERENDER_PATHS.filter((p) =>\n  matchRoutes(routes as any, p.replace(/\\/*$/, '/')),\n);\nif (valid.length !== PRERENDER_PATHS.length) {\n  throw new Error(`Unknown prerender paths: ${PRERENDER_PATHS.filter((p) => !valid.includes(p))}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await build();\n} catch (e) {\n  if (e instanceof Error && e.message.includes('does not match any routes')) {\n    // the message names the bad path — fix or remove it from prerender config\n  }\n}","preventionTips":["Derive prerender paths from `getStaticPaths()` or the route manifest instead of hardcoding","Add a CI check that diffs CMS-provided paths against route patterns","Keep paths origin-less and consistently slashed"],"tags":["prerender","ssg","routing","build"],"backgroundTag":"route-not-found","analyzedSha":"6beaca39526d5716c3c112ebb0782765baa5a9ce","analyzedAt":"2026-08-18T18:04:14.938Z","contentChangedAt":"2026-08-18T18:04:14.938Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}