{"record":{"id":"c69995caabbc7f87","repo":"withastro/astro","slug":"missingindexforinternationalizationerror","errorCode":"MissingIndexForInternationalizationError","errorMessage":"Could not find index page. A root index page is required in order to create a redirect to the index URL of the default locale. (`/${defaultLocale}`)","messagePattern":"Could not find index page\\. A root index page is required in order to create a redirect to the index URL of the default locale\\. \\(`/(.+?)`\\)","errorType":"validation","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/core/routing/create-manifest.ts","lineNumber":774,"sourceCode":"\t// Report route collisions\n\tfor (const [index, higherRoute] of routes.entries()) {\n\t\tfor (const lowerRoute of routes.slice(index + 1)) {\n\t\t\tdetectRouteCollision(higherRoute, lowerRoute, config, logger);\n\t\t}\n\t}\n\n\tconst i18n = settings.config.i18n;\n\tif (i18n) {\n\t\tconst strategy = toRoutingStrategy(i18n.routing, i18n.domains);\n\t\t// First we check if the user doesn't have an index page.\n\t\tif (strategy === 'pathname-prefix-always') {\n\t\t\tlet index = routes.find((route) => route.route === '/');\n\t\t\tif (!index) {\n\t\t\t\tlet relativePath = path.relative(\n\t\t\t\t\tfileURLToPath(settings.config.root),\n\t\t\t\t\tfileURLToPath(new URL('pages', settings.config.srcDir)),\n\t\t\t\t);\n\t\t\t\tthrow new AstroError({\n\t\t\t\t\t...MissingIndexForInternationalization,\n\t\t\t\t\tmessage: MissingIndexForInternationalization.message(i18n.defaultLocale),\n\t\t\t\t\thint: MissingIndexForInternationalization.hint(relativePath),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tcreateI18nFallbackRoutes(routes, i18n, config);\n\t}\n\n\tif (dev) {\n\t\t// In SSR, a 404 route is injected in the App directly for some special handling,\n\t\t// it must not appear in the manifest\n\t\tensure404Route({ routes });\n\t}\n\tif (dev || settings.buildOutput === 'server') {\n\t\tinjectImageEndpoint(settings, { routes }, dev ? 'dev' : 'build');\n\t}","sourceCodeStart":756,"sourceCodeEnd":792,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/core/routing/create-manifest.ts#L756-L792","documentation":"MissingIndexForInternationalization: with i18n routing strategy 'pathname-prefix-always', Astro builds a redirect from '/' to the default locale's index ('/defaultLocale'). That redirect requires a root index page (route '/'). If no route with route === '/' exists, the redirect target is missing and Astro throws at manifest creation.","triggerScenarios":"Enabling i18n with prefixDefaultLocale: true (pathname-prefix-always) but having no src/pages/index.astro (or equivalent); the only index lives under a locale folder; index page was deleted.","commonSituations":"Setting up i18n for the first time without a root index page; restructuring pages into locale subfolders and removing the root index; i18n.defaultLocale pointing to a locale with no root index.","solutions":["Create an index page at src/pages/index.astro (or index.md).","If you don't want the auto-redirect, set i18n.routing.prefixDefaultLocale to false.","Verify the root index page resolves to route '/' (check it is not accidentally nested)."],"exampleFix":"// before — no src/pages/index.astro, i18n prefixDefaultLocale: true\n\n// after — create src/pages/index.astro\n---\n<html><body>Home</body></html>","handlingStrategy":"validation","validationCode":"function hasRootIndex(routes: { route: string }[]): boolean {\n  return routes.some(r => r.route === '/');\n}\n// when using pathname-prefix-always i18n, ensure this is true","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always create src/pages/index.astro when enabling prefixDefaultLocale.","If you don't want the auto-redirect, set prefixDefaultLocale to false.","Add an onboarding check in CI that asserts a '/' route exists when i18n is on."],"tags":["i18n","routing","config","redirect"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}