{"record":{"id":"fa4d51fa4f4ccc6c","repo":"sveltejs/kit","slug":"multiple-page-component-files-found-in-routes-ba","errorCode":null,"errorMessage":"Multiple page component files found in ${routes_base}${route.id} : ${path.basename(existing_file)} and ${file.name}","messagePattern":"Multiple page component files found in (.+?)(.+?) : (.+?) and (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/kit/src/core/sync/create_manifest_data/index.js","lineNumber":322,"sourceCode":"\t\t\t\t\tif (item.is_error) {\n\t\t\t\t\t\troute.error = {\n\t\t\t\t\t\t\tdepth,\n\t\t\t\t\t\t\tcomponent: project_relative\n\t\t\t\t\t\t};\n\t\t\t\t\t} else if (item.is_layout) {\n\t\t\t\t\t\tif (!route.layout) {\n\t\t\t\t\t\t\troute.layout = { depth, child_pages: [] };\n\t\t\t\t\t\t} else if (route.layout.component) {\n\t\t\t\t\t\t\tthrow duplicate_files_error('layout component', route.layout.component);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\troute.layout.component = project_relative;\n\t\t\t\t\t\tif (item.uses_layout !== undefined) route.layout.parent_id = item.uses_layout;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!route.leaf) {\n\t\t\t\t\t\t\troute.leaf = { depth };\n\t\t\t\t\t\t} else if (route.leaf.component) {\n\t\t\t\t\t\t\tthrow duplicate_files_error('page component', route.leaf.component);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\troute.leaf.component = project_relative;\n\t\t\t\t\t\tif (item.uses_layout !== undefined) route.leaf.parent_id = item.uses_layout;\n\t\t\t\t\t}\n\t\t\t\t} else if (item.is_layout) {\n\t\t\t\t\tif (!route.layout) {\n\t\t\t\t\t\troute.layout = { depth, child_pages: [] };\n\t\t\t\t\t} else if (route.layout[item.kind]) {\n\t\t\t\t\t\tthrow duplicate_files_error(\n\t\t\t\t\t\t\titem.kind + ' layout module',\n\t\t\t\t\t\t\t/** @type {string} */ (route.layout[item.kind])\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\troute.layout[item.kind] = project_relative;\n\t\t\t\t} else if (item.is_page) {\n\t\t\t\t\tif (!route.leaf) {","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/sync/create_manifest_data/index.js#L304-L340","documentation":"SvelteKit allows only one page component per route. When walk encounters a second page component file (+page.svelte variants) mapping to the same route id, it throws duplicate_files_error('page component', existing) with both file names in the message.","triggerScenarios":"Two page component files in the same route directory, e.g. `+page.svelte` and `+page@other.svelte`, or leftover duplicates after refactor/copy operations.","commonSituations":"Duplicating a route folder and keeping both files in one directory; experimenting with named pages (+page@name.svelte) alongside an existing +page.svelte; case-insensitive filesystem collisions.","solutions":["Delete the extra page component file in that route directory","If you meant different layouts per page, place them in separate route directories","Run sync again to verify the manifest generates cleanly"],"exampleFix":"# before\nsrc/routes/about/+page.svelte\nsrc/routes/about/+page@marketing.svelte\n\n# after\nsrc/routes/about/+page.svelte","handlingStrategy":"validation","validationCode":"import { readdirSync } from 'node:fs';\nconst files = readdirSync('src/routes', { recursive: true });\nfor (const dir of new Set(files.map((f) => f.split('/').slice(0, -1).join('/')))) {\n  const pages = files.filter((f) => f.startsWith(dir) && /\\+page(@[^/]+)?\\.svelte$/.test(f));\n  if (pages.length > 1) throw new Error(`duplicate page component in ${dir}: ${pages}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["One +page.svelte per route directory","Clean up copies after duplicating route folders","Run `svelte-kit sync` in CI to surface route conflicts early"],"tags":["routing","config","duplicate-files"],"backgroundTag":"duplicate-route-file","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}