sveltejs/kit · error · Error

Multiple page component files found in ${routes_base}${route

Error message

Multiple page component files found in ${routes_base}${route.id} : ${path.basename(existing_file)} and ${file.name}

What it means

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.

Source

Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:322

					if (item.is_error) {
						route.error = {
							depth,
							component: project_relative
						};
					} else if (item.is_layout) {
						if (!route.layout) {
							route.layout = { depth, child_pages: [] };
						} else if (route.layout.component) {
							throw duplicate_files_error('layout component', route.layout.component);
						}

						route.layout.component = project_relative;
						if (item.uses_layout !== undefined) route.layout.parent_id = item.uses_layout;
					} else {
						if (!route.leaf) {
							route.leaf = { depth };
						} else if (route.leaf.component) {
							throw duplicate_files_error('page component', route.leaf.component);
						}

						route.leaf.component = project_relative;
						if (item.uses_layout !== undefined) route.leaf.parent_id = item.uses_layout;
					}
				} else if (item.is_layout) {
					if (!route.layout) {
						route.layout = { depth, child_pages: [] };
					} else if (route.layout[item.kind]) {
						throw duplicate_files_error(
							item.kind + ' layout module',
							/** @type {string} */ (route.layout[item.kind])
						);
					}

					route.layout[item.kind] = project_relative;
				} else if (item.is_page) {
					if (!route.leaf) {

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Delete the extra page component file in that route directory
  2. If you meant different layouts per page, place them in separate route directories
  3. Run sync again to verify the manifest generates cleanly

Example fix

# before
src/routes/about/+page.svelte
src/routes/about/+page@marketing.svelte

# after
src/routes/about/+page.svelte
Defensive patterns

Strategy: validation

Validate before calling

import { readdirSync } from 'node:fs';
const files = readdirSync('src/routes', { recursive: true });
for (const dir of new Set(files.map((f) => f.split('/').slice(0, -1).join('/')))) {
  const pages = files.filter((f) => f.startsWith(dir) && /\+page(@[^/]+)?\.svelte$/.test(f));
  if (pages.length > 1) throw new Error(`duplicate page component in ${dir}: ${pages}`);
}

Prevention

When it happens

Trigger: Two page component files in the same route directory, e.g. `+page.svelte` and `+page@other.svelte`, or leftover duplicates after refactor/copy operations.

Common situations: 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.

Related errors


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/fa4d51fa4f4ccc6c. Report an issue: GitHub.