{"record":{"id":"632d8ec4e32805b7","repo":"withastro/astro","slug":"no-fallback-route-found-for-route-route-route","errorCode":null,"errorMessage":"No fallback route found for route ${route.route}","messagePattern":"No fallback route found for route (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/astro/src/core/routing/helpers.ts","lineNumber":47,"sourceCode":" *\n * It throws an error if no fallback routes were found. This means there's an error\n * when we construct the list of routes\n * @param route\n * @param routeList\n */\nexport function getFallbackRoute(route: RouteData, routeList: RouteInfo[]): RouteData {\n\tconst fallbackRoute = routeList.find((r) => {\n\t\t// The index doesn't have a fallback route\n\t\tif (route.route === '/' && r.routeData.route === '/') {\n\t\t\treturn true;\n\t\t}\n\t\treturn r.routeData.fallbackRoutes.find((f) => {\n\t\t\treturn f.route === route.route;\n\t\t});\n\t});\n\n\tif (!fallbackRoute) {\n\t\tthrow new Error(`No fallback route found for route ${route.route}`);\n\t}\n\n\treturn fallbackRoute.routeData;\n}\n\n/**\n * Return a user-provided 404 route if one exists.\n */\nexport function getCustom404Route(manifestData: RoutesList): RouteData | undefined {\n\treturn manifestData.routes.find((r) => isRoute404(r.route));\n}\n\n/**\n * Return a user-provided 500 route if one exists.\n */\nexport function getCustom500Route(manifestData: RoutesList): RouteData | undefined {\n\treturn manifestData.routes.find((r) => isRoute500(r.route));\n}","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/core/routing/helpers.ts#L29-L65","documentation":"Internal guard in getFallbackRoute(): no fallback route was found for the given route. Astro looks up i18n fallback routes by matching the route against each route's fallbackRoutes list; if none matches, the lookup fails with a plain Error. This indicates an inconsistency in the generated route table rather than a user mistake.","triggerScenarios":"Calling getFallbackRoute() for a route that has no corresponding fallback (e.g. the index '/'); i18n config produces fallbackRoutes that don't reference the queried route; internal caller invoking the helper on an unsupported route.","commonSituations":"i18n fallback configuration changes; calling the helper outside the intended i18n flow; an internal regression where fallbackRoutes wasn't populated.","solutions":["Confirm the route is expected to have a fallback under your i18n.routing config.","For the index route '/', the helper expects the fallback to be the index itself — ensure a '/' route exists.","If not an i18n route, do not call getFallbackRoute(); file an issue if Astro itself invoked it incorrectly."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function hasFallbackRoute(route: RouteData, routeList: RouteInfo[]): boolean {\n  return routeList.some(r => r.routeData.fallbackRoutes.some(f => f.route === route.route));\n}\n// check before calling getFallbackRoute","typeGuard":null,"tryCatchPattern":"try {\n  const fb = getFallbackRoute(route, routeList);\n} catch (e) {\n  if (e instanceof Error && /No fallback route/.test(e.message)) {\n    // handle missing fallback (e.g. 404)\n  }\n  throw e;\n}","preventionTips":["Only call getFallbackRoute() for routes that the i18n config gives fallbacks.","Treat the index '/' route specially — its fallback is itself.","If Astro triggers this internally, file an issue with the route table."],"tags":["internal","i18n","routing","fallback"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}