sveltejs/kit · error · Error

Multiple endpoint files found in ${routes_base}${route.id} :

Error message

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

What it means

Route-tree validation while walking src/routes: a directory already had an endpoint file registered (route.endpoint set), and another endpoint candidate (e.g. a second +server.js under a different module extension like .js/.ts) was found in the same route. SvelteKit allows at most one endpoint per route; duplicate_files_error normally formats this, and the walk throws naming both conflicting files.

Source

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

							/** @type {string} */ (route.layout[item.kind])
						);
					}

					route.layout[item.kind] = project_relative;
				} else if (item.is_page) {
					if (!route.leaf) {
						route.leaf = { depth };
					} else if (route.leaf[item.kind]) {
						throw duplicate_files_error(
							item.kind + ' page module',
							/** @type {string} */ (route.leaf[item.kind])
						);
					}

					route.leaf[item.kind] = project_relative;
				} else {
					if (route.endpoint) {
						throw duplicate_files_error('endpoint', route.endpoint.file);
					}

					route.endpoint = {
						file: project_relative,
						page_options: null // will be filled later
					};
				}
			}

			// then handle children
			for (const file of files) {
				if (file.is_dir) {
					walk(depth + 1, path.posix.join(id, file.name), file.name, route);
				}
			}
		};

		walk(0, '/', '', null);

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Delete one of the two endpoint files, keeping a single +server.* per route directory
  2. Avoid mixing module extensions for the same route file, e.g. +server.js and +server.ts in one directory
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:352 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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