sveltejs/kit · critical
${manifest_error.message ?? 'Invalid routes'}
Error message
${manifest_error.message ?? 'Invalid routes'} What it means
In the Vite dev server, when evaluating the generated server manifest fails (e.g. the manifest module throws on import), SvelteKit returns a 500 HTML error page to the browser with the thrown error's message, or the fallback text 'Invalid routes'. It means SvelteKit could not build/parse the route manifest for dev mode, so no routes can be served.
Source
Thrown at packages/kit/src/exports/vite/dev/index.js:417
const request = (svelte_config.adapter?.vite?.getRequest ?? getRequest)({
base,
request: req,
response: res
});
if (manifest_error) {
console.error(styleText(['bold', 'red'], manifest_error.message));
const error_page = load_error_page(svelte_config);
/** @param {{ status: number; message: string }} opts */
const error_template = ({ status, message }) => {
return error_page
.replace(/%sveltekit\.status%/g, String(status))
.replace(/%sveltekit\.error\.message%/g, escape_html(message));
};
res.writeHead(500, {
'Content-Type': 'text/html; charset=utf-8'
});
res.end(
error_template({ status: 500, message: manifest_error.message ?? 'Invalid routes' })
);
return;
}
const rendered = await server.respond(request, {
getClientAddress: () => {
const { remoteAddress } = req.socket;
if (remoteAddress) return remoteAddress;
throw new Error('Could not determine clientAddress');
},
read: (file) => {
if (file in manifest.server_assets) {
return fs.readFileSync(from_fs(file));View on GitHub (pinned to 03f1687fe6)
Solutions
- Read the underlying manifest_error stack trace printed in the terminal to find the real cause.
- Check all route files under src/routes for invalid filenames or syntax errors.
- Delete node_modules/.vite and restart the dev server to clear stale cache.
- Verify svelte.config.js and plugin versions match (svelte, @sveltejs/kit, vite).
Example fix
// before: broken route file src/routes/[slug/[nested/page.svelte // after: fix the invalid route segment nesting or rename the file src/routes/[slug]/[nested]/page.svelte
Defensive patterns
Strategy: fallback
Validate before calling
// before dev: sanity check route files exist and config parses
import { readFileSync } from 'node:fs';
const cfg = readFileSync('svelte.config.js', 'utf8');
if (!cfg) throw new Error('missing svelte.config.js'); Prevention
- Validate route file names before committing (no mixed bracket nesting).
- Clear node_modules/.vite after upgrading SvelteKit or Vite.
- Keep svelte/kit and vite versions in the ranges recommended by the adapter docs.
When it happens
Trigger: Running `vite dev` when the server manifest module (src/manifest.js) throws during import — typically a syntax/runtime error in generated manifest code, an invalid +page/+server file that breaks route parsing, or a plugin corrupting the manifest.
Common situations: Malformed route file names, a broken svelte.config.js, incompatibilities after upgrading SvelteKit/Vite, or a custom Vite plugin that patches the manifest incorrectly; the browser shows a 500 page saying 'Invalid routes'.
Related errors
- The configured Vite SSR environment must be a RunnableDevEnv
- The ${route.id} and ${existing.route_id} routes must be merg
- @sveltejs/enhanced-img requires @sveltejs/vite-plugin-svelte
- Could not locate ${file_path}. Please move it to be located
- Could not locate ${file_path}. See https://vitejs.dev/guide/
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/048243b046705bca.
Report an issue: GitHub.