{"record":{"id":"d3f8c25b53c512c3","repo":"sveltejs/kit","slug":"multiple-item-kind-page-module-files-found-in","errorCode":null,"errorMessage":"Multiple ${item.kind} page module files found in ${routes_base}${route.id} : ${path.basename(existing_file)} and ${file.name}","messagePattern":"Multiple (.+?) page module files found in (.+?)(.+?) : (.+?) and (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/kit/src/core/sync/create_manifest_data/index.js","lineNumber":343,"sourceCode":"\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) {\n\t\t\t\t\t\troute.leaf = { depth };\n\t\t\t\t\t} else if (route.leaf[item.kind]) {\n\t\t\t\t\t\tthrow duplicate_files_error(\n\t\t\t\t\t\t\titem.kind + ' page module',\n\t\t\t\t\t\t\t/** @type {string} */ (route.leaf[item.kind])\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\troute.leaf[item.kind] = project_relative;\n\t\t\t\t} else {\n\t\t\t\t\tif (route.endpoint) {\n\t\t\t\t\t\tthrow duplicate_files_error('endpoint', route.endpoint.file);\n\t\t\t\t\t}\n\n\t\t\t\t\troute.endpoint = {\n\t\t\t\t\t\tfile: project_relative,\n\t\t\t\t\t\tpage_options: null // will be filled later\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/sync/create_manifest_data/index.js#L325-L361","documentation":"Each route may have at most one page module of a given kind (+page.js or +page.ts). When walk detects two same-kind page module files mapping to the same route id, it throws duplicate_files_error('<kind> page module', existing), listing both files.","triggerScenarios":"`+page.js` and `+page.ts` coexist in the same route directory (or another same-kind duplicate), so two page module files compete for one route.","commonSituations":"Converting +page.js to +page.ts without deleting the original; branch merges reintroducing the old module; generated or backup copies left in the routes tree.","solutions":["Remove the obsolete page module file (keep only +page.js or +page.ts per route)","Port any load/exports from the removed file into the surviving one","Re-run `vite dev` or `svelte-kit sync` to confirm route creation succeeds"],"exampleFix":"# before\nsrc/routes/blog/+page.js\nsrc/routes/blog/+page.ts\n\n# after (merged into one)\nsrc/routes/blog/+page.ts","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nconst dir = 'src/routes/blog';\nif (existsSync(`${dir}/+page.js`) && existsSync(`${dir}/+page.ts`)) {\n  throw new Error('duplicate page module: keep only +page.js or +page.ts');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never keep +page.js and +page.ts together","Complete JS-to-TS migrations atomically per route","Add a CI glob check for duplicate route modules"],"tags":["routing","typescript","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"}