sveltejs/kit · error
Cannot prerender a route (${route.id}) with both a `+page.sv
Error message
Cannot prerender a route (${route.id}) with both a `+page.svelte` and a `${endpoint_file}` What it means
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.
Source
Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:512
}
}
// compute the final page options for each page node
for (const node of nodes) {
node.page_options = node_analyser.get_page_options(node);
}
for (const route of routes) {
if (route.endpoint) {
route.endpoint.page_options = get_page_options(route.endpoint.file, cwd);
}
if (route.page && route.endpoint) {
const page = nodes[route.page.leaf];
if (page.page_options?.prerender || route.endpoint.page_options?.prerender) {
const endpoint_file = route.endpoint.file.split('/').pop();
throw new Error(
`Cannot prerender a route (${route.id}) with both a \`+page.svelte\` and a \`${endpoint_file}\``
);
}
}
}
return {
nodes,
routes: sort_routes(routes)
};
}
/**
* Determine if and how the file is relevant to the routing system.
* @param {string} project_relative
* @param {string} file
* @param {string[]} component_extensions
* @param {string[]} module_extensionsView on GitHub (pinned to 03f1687fe6)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:512 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/c34e505d1be0f035.
Report an issue: GitHub.