{"record":{"id":"048243b046705bca","repo":"sveltejs/kit","slug":"manifest-error-message-invalid-routes","errorCode":null,"errorMessage":"${manifest_error.message ?? 'Invalid routes'}","messagePattern":"\\$\\{manifest_error\\.message \\?\\? 'Invalid routes'\\}","errorType":"http","errorClass":null,"httpStatus":500,"severity":"critical","filePath":"packages/kit/src/exports/vite/dev/index.js","lineNumber":417,"sourceCode":"\t\t\t\tconst request = (svelte_config.adapter?.vite?.getRequest ?? getRequest)({\n\t\t\t\t\tbase,\n\t\t\t\t\trequest: req,\n\t\t\t\t\tresponse: res\n\t\t\t\t});\n\n\t\t\t\tif (manifest_error) {\n\t\t\t\t\tconsole.error(styleText(['bold', 'red'], manifest_error.message));\n\n\t\t\t\t\tconst error_page = load_error_page(svelte_config);\n\n\t\t\t\t\t/** @param {{ status: number; message: string }} opts */\n\t\t\t\t\tconst error_template = ({ status, message }) => {\n\t\t\t\t\t\treturn error_page\n\t\t\t\t\t\t\t.replace(/%sveltekit\\.status%/g, String(status))\n\t\t\t\t\t\t\t.replace(/%sveltekit\\.error\\.message%/g, escape_html(message));\n\t\t\t\t\t};\n\n\t\t\t\t\tres.writeHead(500, {\n\t\t\t\t\t\t'Content-Type': 'text/html; charset=utf-8'\n\t\t\t\t\t});\n\t\t\t\t\tres.end(\n\t\t\t\t\t\terror_template({ status: 500, message: manifest_error.message ?? 'Invalid routes' })\n\t\t\t\t\t);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst rendered = await server.respond(request, {\n\t\t\t\t\tgetClientAddress: () => {\n\t\t\t\t\t\tconst { remoteAddress } = req.socket;\n\t\t\t\t\t\tif (remoteAddress) return remoteAddress;\n\t\t\t\t\t\tthrow new Error('Could not determine clientAddress');\n\t\t\t\t\t},\n\t\t\t\t\tread: (file) => {\n\t\t\t\t\t\tif (file in manifest.server_assets) {\n\t\t\t\t\t\t\treturn fs.readFileSync(from_fs(file));","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/exports/vite/dev/index.js#L399-L435","documentation":"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.","triggerScenarios":"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.","commonSituations":"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'.","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)."],"exampleFix":"// before: broken route file src/routes/[slug/[nested/page.svelte\n// after: fix the invalid route segment nesting or rename the file\nsrc/routes/[slug]/[nested]/page.svelte","handlingStrategy":"fallback","validationCode":"// before dev: sanity check route files exist and config parses\nimport { readFileSync } from 'node:fs';\nconst cfg = readFileSync('svelte.config.js', 'utf8');\nif (!cfg) throw new Error('missing svelte.config.js');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["dev-server","routes","manifest","vite"],"backgroundTag":"invalid-route-manifest","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}