{"record":{"id":"2cda2b6cabdae0fc","repo":"withastro/astro","slug":"astro-couldn-t-find-the-correct-page-to-render-pr-2cda2b","errorCode":null,"errorMessage":"Astro couldn't find the correct page to render, probably because it wasn't correctly mapped for SSR usage. This is an internal error, please file an issue.","messagePattern":"Astro couldn't find the correct page to render, probably because it wasn't correctly mapped for SSR usage\\. This is an internal error, please file an issue\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/astro/src/vite-plugin-app/environment.ts","lineNumber":89,"sourceCode":"\t\t\t};\n\t\t}\n\t}\n\n\tif (route.type === 'redirect') {\n\t\treturn RedirectSinglePageBuiltModule;\n\t} else {\n\t\tif (manifest.pageMap) {\n\t\t\tconst importComponentInstance = manifest.pageMap.get(route.component);\n\t\t\tif (!importComponentInstance) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Unexpectedly unable to find a component instance for route ${route.route}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn await importComponentInstance();\n\t\t} else if (manifest.pageModule) {\n\t\t\treturn manifest.pageModule;\n\t\t}\n\t\tthrow new Error(\n\t\t\t\"Astro couldn't find the correct page to render, probably because it wasn't correctly mapped for SSR usage. This is an internal error, please file an issue.\",\n\t\t);\n\t}\n}\n\n/**\n * The runnable dev environment (the Vite SSR environment can load modules at\n * runtime). The ModuleLoader and AstroSettings are captured in this closure at\n * composition time (`createAstroServerApp`) and are unreachable from\n * requests/states by design — only the environment functions close over them.\n */\nexport function createRunnableEnvironment({\n\tloader,\n\tsettings,\n\tgetDebugInfo,\n}: RunnableEnvironmentOptions): RenderEnvironment {\n\t// Renderers are (re)loaded on every request before the route module is\n\t// imported, into the per-manifest slot.","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/astro/src/vite-plugin-app/environment.ts#L71-L107","documentation":"A safety net in the dev environment's module loader: after redirect and default routes are handled, the code needs either a pageMap or a pageModule on the SSR manifest to serve the route. Neither being present means the manifest was constructed with no way to load page modules — an Astro-internal defect or a malformed manifest supplied by a custom environment. The message asks you to file an issue because no normal user configuration should reach this path.","triggerScenarios":"A custom environment or adapter constructing an SSRManifest without pageMap or pageModule; workspace setups mixing mismatched Astro versions so manifest shape and loader expectations diverge; experimental dev-environment code paths.","commonSituations":"Linked or patched local Astro checkouts with partially updated packages; extremely rare on released versions.","solutions":["Clean install: remove node_modules, reinstall, and restart to eliminate version mixing","Verify only one version of astro is installed (npm ls astro)","If it reproduces on a released version, file an Astro issue with your config and a reproduction — this path is explicitly flagged as an internal error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n\tconst response = await app.render(request);\n} catch (err) {\n\tif (err instanceof Error && err.message.includes('correctly mapped for SSR usage')) {\n\t\t// manifest lacks pageMap/pageModule: verify a single astro version (npm ls astro) and reinstall\n\t}\n\tthrow err;\n}","preventionTips":["Keep exactly one version of astro in the dependency tree (npm ls astro)","Do not hand-build SSRManifest objects without pageMap or pageModule in custom environments","Reinstall dependencies from scratch when switching between released and linked astro versions"],"tags":["internal","dev-server","manifest","ssr"],"backgroundTag":"ssr-route-resolution-failed","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}