sveltejs/kit · error

Route ${id} should be renamed to ${id.replace(/#/g, '[x+23]'

Error message

Route ${id} should be renamed to ${id.replace(/#/g, '[x+23]')}

What it means

Route ID validation error: the current route segment contains a '#' character. Vite cannot handle module requests for files containing '#', so SvelteKit rejects such route names and suggests the escape form [x+23], which produces the same URL path segment '#' at runtime. Fires during route walking in sync/dev.

Source

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

							`Unicode escape sequence in ${id} must be between four and six characters`
						);
					}

					return String.fromCodePoint(parseInt(code, 16));
				}
			});

			if (/\]\[/.test(unescaped)) {
				throw new Error(`Invalid route ${id} — parameters must be separated`);
			}

			if (count_occurrences('[', id) !== count_occurrences(']', id)) {
				throw new Error(`Invalid route ${id} — brackets are unbalanced`);
			}

			if (/#/.test(segment)) {
				// Vite will barf on files with # in them
				throw new Error(`Route ${id} should be renamed to ${id.replace(/#/g, '[x+23]')}`);
			}

			if (/\[\.\.\.[\w-]+\]\/\[\[/.test(id)) {
				throw new Error(
					`Invalid route ${id} — an [[optional]] route segment cannot follow a [...rest] route segment`
				);
			}

			if (/\[\[\.\.\./.test(id)) {
				throw new Error(
					`Invalid route ${id} — a rest route segment is always optional, remove the outer square brackets`
				);
			}

			const { pattern, params } = parse_route_id(id);

			/** @type {import('types').RouteData} */
			const route = {

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Rename the file replacing '#' with '[x+23]', e.g. 'page#1' becomes 'page[x+23]1'
  2. Avoid hash characters in route file and directory names
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:176 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/9491cf6807a00c12. Report an issue: GitHub.