{"record":{"id":"3284c5f7f3a2a1f1","repo":"withastro/astro","slug":"nomatchingstaticpathfound","errorCode":"NoMatchingStaticPathFound","errorMessage":"A `getStaticPaths()` route pattern was matched, but no matching static path was found for requested path `${pathName}`.","messagePattern":"A `getStaticPaths\\(\\)` route pattern was matched, but no matching static path was found for requested path `(.+?)`\\.","errorType":"exception","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/core/render/params-and-props.ts","lineNumber":66,"sourceCode":"\n\t// During build, the route cache should already be populated.\n\t// During development, the route cache is filled on-demand and may be empty.\n\tconst staticPaths = await callGetStaticPaths({\n\t\tmod,\n\t\troute,\n\t\trouteCache,\n\t\tssr: serverLike,\n\t\tbase,\n\t\ttrailingSlash,\n\t});\n\n\t// The pathname used here comes from the server, which already encoded.\n\t// Since we decided to not mess up with encoding anymore, we need to decode them back so the parameters can match\n\t// the ones expected from the users\n\tconst params = getParams(route, pathname);\n\tconst matchedStaticPath = findPathItemByKey(staticPaths, params, route, logger, trailingSlash);\n\tif (!matchedStaticPath && route.origin !== 'internal' && (serverLike ? route.prerender : true)) {\n\t\tthrow new AstroError({\n\t\t\t...AstroErrorData.NoMatchingStaticPathFound,\n\t\t\tmessage: AstroErrorData.NoMatchingStaticPathFound.message(pathname),\n\t\t\thint: AstroErrorData.NoMatchingStaticPathFound.hint([route.component]),\n\t\t});\n\t}\n\n\tif (mod) {\n\t\tvalidatePrerenderEndpointCollision(route, mod, params);\n\t}\n\n\tconst props: Props = matchedStaticPath?.props ? { ...matchedStaticPath.props } : {};\n\n\treturn props;\n}\n\n/**\n * When given a route with the pattern `/[x]/[y]/[z]/svelte`, and a pathname `/a/b/c/svelte`,\n * returns the params object: { x: \"a\", y: \"b\", z: \"c\" }.","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/core/render/params-and-props.ts#L48-L84","documentation":"A dynamic route's pattern matched the requested URL, but getStaticPaths() did not return a params entry matching that URL. For prerendered (or SSR prerender-default) non-internal routes, every reachable URL must be enumerated by getStaticPaths().","triggerScenarios":"Requesting /blog/99 when getStaticPaths only returned ids 1..10; a typo in the requested path vs. generated params; params case mismatch; getStaticPaths filtering out entries that users can still navigate to; changing data source so fewer paths are generated.","commonSituations":"Stale links pointing to deleted content; content collection entry removed but still linked; query-param or slug mismatch between generated and requested paths; running in static/hybrid output where unmatched dynamic routes are not server-rendered.","solutions":["Ensure getStaticPaths() returns a params object whose values match the requested path.","If the route should handle arbitrary paths at runtime, mark it server-rendered with `export const prerender = false`.","Check for typos or encoding differences between the link and the param value.","Return a 404 intentionally via a custom 404 page instead of letting the unmatched route throw."],"exampleFix":"// before\nexport async function getStaticPaths() {\n  return [\n    { params: { slug: 'hello-world' } }\n  ];\n}\n// request to /blog/hello-word (typo) throws\n\n// after — render on demand so unknown slugs don't crash the build\nexport const prerender = false;","handlingStrategy":"validation","validationCode":"// ensure every reachable path is in getStaticPaths\nconst known = new Set(slugs.map(s => `/blog/${s}`));\nif (!known.has(requestedPath)) {\n  // return a controlled 404 instead of letting Astro throw\n  return new Response('Not found', { status: 404 });\n}","typeGuard":null,"tryCatchPattern":"try {\n  // render the matched static path\n} catch (e) {\n  if (e instanceof AstroError && e.code === 'NoMatchingStaticPathFound') {\n    return new Response(null, { status: 404 });\n  }\n  throw e;\n}","preventionTips":["If the route must serve arbitrary paths, set `export const prerender = false`.","Cross-check internal links against the params returned by getStaticPaths().","Keep a canonical list of slugs/ids and validate links against it."],"tags":["routing","getstaticpaths","dynamic-routes","prerender"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}