sveltejs/kit · error
Files and directories prefixed with + are reserved (saw ${pr
Error message
Files and directories prefixed with + are reserved (saw ${project_relative}) What it means
This is the final fallback in analyze(): any `+`-prefixed file or directory in src/routes that is neither a recognized Svelte component nor a recognized JS/TS module is rejected. SvelteKit reserves the entire `+` namespace under routes, so a +node_modules dir, +assets folder, or +README.md will abort sync with this message.
Source
Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:573
if (!match) {
throw new Error(`Files prefixed with + are reserved (saw ${project_relative})`);
} else if (match[3] || match[6]) {
throw new Error(
// prettier-ignore
`Only Svelte files can reference named layouts. Remove '${match[3] || match[6]}' from ${file} (at ${project_relative})`
);
}
const kind = match[1] || match[4] || match[7] ? 'server' : 'universal';
return {
kind,
is_page: !!match[2],
is_layout: !!match[5]
};
}
throw new Error(`Files and directories prefixed with + are reserved (saw ${project_relative})`);
}
/**
* @param {string} needle
* @param {string} haystack
*/
function count_occurrences(needle, haystack) {
let count = 0;
for (let i = 0; i < haystack.length; i += 1) {
if (haystack[i] === needle) count += 1;
}
return count;
}
View on GitHub (pinned to 03f1687fe6)
Solutions
- Rename the file/directory so it does not start with `+`, or move it out of src/routes.
- Use the documented reserved names only (+page, +layout, +error, +server with allowed extensions).
- Store shared code outside src/routes (e.g. src/lib) rather than prefixing with `+`.
Example fix
// before src/routes/+components/Button.svelte // after src/lib/components/Button.svelte
Defensive patterns
Strategy: validation
Validate before calling
for (const entry of fs.readdirSync('src/routes', { recursive: true })) {
if (path.basename(String(entry)).startsWith('+') && !/^\+(page|layout|error|server)(\..+)?$/.test(path.basename(String(entry)))) {
throw new Error(`Reserved + prefix on non-route entry: ${entry}`);
}
} Type guard
function isReservedRouteEntry(basename) {
return basename.startsWith('+');
} Try / catch
null
Prevention
- Never name files or folders with a leading + anywhere under src/routes.
- Keep backups, notes, and helpers in src/lib or outside the routes tree.
- Add a pre-commit check that flags + prefixed unknown entries in routes.
When it happens
Trigger: A `+`-prefixed path in src/routes that matches no component or module pattern: directories like +components/, files like +notes.md, +data.json, or +helpers.js (unrecognized base name).
Common situations: Folders starting with + such as +stash/ or +backups/ inside routes; dependency output accidentally written into src/routes with a + prefix; users inventing files like +store.js expecting special behavior.
Related errors
- Files prefixed with + are reserved (saw ${project_relative})
- Only Svelte files can reference named layouts. Remove '${mat
- Invalid route ID ${id}
- Invalid param definition
- Missing params for dynamic route ID ${id}
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/929ffd471504a72f.
Report an issue: GitHub.