{"record":{"id":"c34e505d1be0f035","repo":"sveltejs/kit","slug":"cannot-prerender-a-route-route-id-with-both-a","errorCode":null,"errorMessage":"Cannot prerender a route (${route.id}) with both a `+page.svelte` and a `${endpoint_file}`","messagePattern":"Cannot prerender a route \\((.+?)\\) with both a `\\+page\\.svelte` and a `(.+?)`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/kit/src/core/sync/create_manifest_data/index.js","lineNumber":512,"sourceCode":"\t\t}\n\t}\n\n\t// compute the final page options for each page node\n\tfor (const node of nodes) {\n\t\tnode.page_options = node_analyser.get_page_options(node);\n\t}\n\n\tfor (const route of routes) {\n\t\tif (route.endpoint) {\n\t\t\troute.endpoint.page_options = get_page_options(route.endpoint.file, cwd);\n\t\t}\n\n\t\tif (route.page && route.endpoint) {\n\t\t\tconst page = nodes[route.page.leaf];\n\t\t\tif (page.page_options?.prerender || route.endpoint.page_options?.prerender) {\n\t\t\t\tconst endpoint_file = route.endpoint.file.split('/').pop();\n\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Cannot prerender a route (${route.id}) with both a \\`+page.svelte\\` and a \\`${endpoint_file}\\``\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tnodes,\n\t\troutes: sort_routes(routes)\n\t};\n}\n\n/**\n * Determine if and how the file is relevant to the routing system.\n * @param {string} project_relative\n * @param {string} file\n * @param {string[]} component_extensions\n * @param {string[]} module_extensions","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/sync/create_manifest_data/index.js#L494-L530","documentation":"Prerender validation error while finalizing route metadata: a route contains both a +page.svelte and a standalone endpoint file (e.g. +server.js), and at least one of them opts into prerendering. Prerendering such a route is ambiguous because the prerenderer would fetch the endpoint while also rendering the page, so SvelteKit refuses. The message names the endpoint file that conflicts.","triggerScenarios":"Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:512 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove `export const prerender = true` from the page and the endpoint file for this route","Move the endpoint logic into +page.server.js load functions instead of a separate +server.js file","Exclude this route from prerendering and serve it dynamically"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}