{"record":{"id":"6f0746dd2cd723c4","repo":"sveltejs/kit","slug":"files-prefixed-with-are-reserved-saw-project","errorCode":null,"errorMessage":"Files prefixed with + are reserved (saw ${project_relative})","messagePattern":"Files prefixed with \\+ are reserved \\(saw (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/kit/src/core/sync/create_manifest_data/index.js","lineNumber":539,"sourceCode":"\t\troutes: sort_routes(routes)\n\t};\n}\n\n/**\n * Determine if and how the file is relevant to the routing system.\n * @param {string} project_relative\n * @param {string} file\n * @param {string[]} component_extensions\n * @param {string[]} module_extensions\n * @returns {import('./types.js').RouteFile}\n */\nfunction analyze(project_relative, file, component_extensions, module_extensions) {\n\tconst component_extension = component_extensions.find((ext) => file.endsWith(ext));\n\tif (component_extension) {\n\t\tconst name = file.slice(0, -component_extension.length);\n\t\tconst match = component_name_pattern.exec(name);\n\t\tif (!match) {\n\t\t\tthrow new Error(`Files prefixed with + are reserved (saw ${project_relative})`);\n\t\t}\n\n\t\treturn {\n\t\t\tkind: 'component',\n\t\t\tis_page: !!match[1],\n\t\t\tis_layout: !!match[3],\n\t\t\tis_error: !!match[5],\n\t\t\tuses_layout: match[2] ?? match[4]\n\t\t};\n\t}\n\n\tconst module_extension = module_extensions.find((ext) => file.endsWith(ext));\n\tif (module_extension) {\n\t\tconst name = file.slice(0, -module_extension.length);\n\t\tconst match = module_name_pattern.exec(name);\n\t\tif (!match) {\n\t\t\tthrow new Error(`Files prefixed with + are reserved (saw ${project_relative})`);\n\t\t} else if (match[3] || match[6]) {","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/sync/create_manifest_data/index.js#L521-L557","documentation":"SvelteKit reserves all files whose names begin with `+` inside src/routes for routing components (+page.svelte, +layout.svelte, +error.svelte). During `svelte-kit sync`, the analyzer tries to parse a `+`-prefixed filename with component_name_pattern (i.e. it must end in .svelte and be exactly +page, +layout@name, or +error); if it does not match, sync aborts. This keeps the route tree unambiguous and prevents typo'd reserved files from being silently ignored.","triggerScenarios":"A file under src/routes has a `+` prefix and a .svelte extension but is not one of +page.svelte, +layout.svelte, +layout@group.svelte, +error.svelte — e.g. +Page.svelte (capital P), +pages.svelte, or +foo.svelte — and is passed to analyze() during create_manifest_data.","commonSituations":"Typos like +Page.svelte or +pagee.svelte in the routes directory; copy-pasting old files into routes without renaming; scaffolding tools creating +lib.svelte-like files; mixing cases on case-insensitive filesystems.","solutions":["Rename the offending file to an exact reserved name: +page.svelte, +layout.svelte, +error.svelte, or +layout@group.svelte.","If it is not a route component, move it out of src/routes (or drop the `+` prefix from its name).","If it is a shared component, rename to e.g. Widget.svelte and place it outside src/routes or in a subfolder not matched as a route file."],"exampleFix":"// before\nsrc/routes/+Page.svelte\n// after\nsrc/routes/+page.svelte","handlingStrategy":"validation","validationCode":"const PATTERN = /^\\+(?:(page(?:@.*)?)|(layout(?:@.*)?)|(error))$/;\nfor (const f of routeFiles.filter((f) => f.startsWith('+') && f.endsWith('.svelte'))) {\n  if (!PATTERN.test(f.slice(0, -'.svelte'.length))) throw new Error(`Invalid reserved Svelte file: ${f}`);\n}","typeGuard":"function isValidRouteComponent(basename) {\n  return /^\\+(?:(page(?:@.*)?)|(layout(?:@.*)?)|(error))$/.test(basename);\n}","tryCatchPattern":"null","preventionTips":["Only use the exact reserved names +page.svelte, +layout.svelte, +error.svelte in src/routes.","Put shared/reusable Svelte components in src/lib, never prefixed with + inside routes.","Lint with a filename convention check (e.g. ESLint filenames rule) on src/routes."],"tags":["sveltekit","routing","file-naming","sync"],"backgroundTag":"reserved-file-name-conflict","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}