{"record":{"id":"7392937b7a6e6291","repo":"sveltejs/kit","slug":"overwriting-dest-with-fallback-page-consider","errorCode":null,"errorMessage":"\nOverwriting ${dest} with fallback page. Consider using a different name for the fallback.\n","messagePattern":"\nOverwriting (.+?) with fallback page\\. Consider using a different name for the fallback\\.\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/core/adapt/builder.js","lineNumber":189,"sourceCode":"\t\t\t\troute_data.map((route) => /** @type {import('types').RouteData} */ (lookup.get(route))),\n\t\t\t\tvite_config.root\n\t\t\t);\n\t\t},\n\n\t\tasync generateFallback(dest) {\n\t\t\tconst manifest_path = `${config.outDir}/output/server/manifest-full.js`;\n\t\t\tconst env = loadEnv(vite_config.mode, config.env.dir, '');\n\n\t\t\tconst fallback = await generate_fallback({\n\t\t\t\tmanifest_path,\n\t\t\t\tenv,\n\t\t\t\tout_dir: config.outDir,\n\t\t\t\torigin: config.paths.origin || 'http://sveltekit-prerender',\n\t\t\t\tassets: config.files.assets\n\t\t\t});\n\n\t\t\tif (existsSync(dest)) {\n\t\t\t\tlog.warn(\n\t\t\t\t\t`\\nOverwriting ${dest} with fallback page. Consider using a different name for the fallback.\\n`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\twrite(dest, fallback);\n\t\t},\n\n\t\tgenerateEnvModule() {\n\t\t\tif (!build_data.client?.uses_env_dynamic_public) return;\n\n\t\t\tconst dest = `${config.outDir}/output/prerendered/dependencies/${config.appDir}`;\n\t\t\tconst env = loadEnv(vite_config.mode, config.env.dir, '');\n\n\t\t\t/** @type {Record<string, any>} */\n\t\t\tconst values = {};\n\t\t\tconst variables = explicit_env_config ?? {};\n\n\t\t\t/** @type {Record<string, StandardSchemaV1.Issue[]>} */","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/adapt/builder.js#L171-L207","documentation":"When prerendering generates a fallback page, generateFallback writes it to `dest` inside the output directory. If a file already exists at that path (e.g. a prerendered page already produced a file with the same name), it would be silently replaced, so the builder logs this warning advising you to rename the fallback to avoid clobbering real content.","triggerScenarios":"Calling generateFallback with `kit.prerender.entries`/fallback configured such that `dest = out_dir + fallback path` already exists from prerendered output, detected via existsSync(dest).","commonSituations":"Setting `fallback: 'index.html'` in a SPA while also prerendering the root route; a fallback name colliding with a prerendered page's directory/file; migrating an SPA to prerendered pages without updating the fallback option.","solutions":["Change `prerender.fallback` in svelte.config.js to a unique filename not produced by prerendering (e.g. '200.html' or 'fallback.html').","If overwriting is intended (SPA serving from the fallback), ignore the warning.","Disable prerendering of the colliding route or exclude it via prerender.entries."],"exampleFix":"// before (svelte.config.js)\nprerender: { fallback: 'index.html' }\n// after\nprerender: { fallback: '200.html' }","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nconst fallbackDest = `.svelte-kit/output/prerendered/${config.prerender.fallback}`;\nif (existsSync(fallbackDest)) {\n  console.warn(`Fallback name collides with prerendered output: ${fallbackDest}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Name the fallback something prerendering never emits (e.g. '200.html')","Never use 'index.html' as a fallback when the root route is prerendered","Audit prerender.entries against the fallback filename after config changes"],"tags":["prerender","fallback","adapter","build-warning"],"backgroundTag":"file-overwritten","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}