sveltejs/kit · error

Unicode escape sequence in ${id} must be between four and si

Error message

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

What it means

Route ID validation error inside create_manifest_data's directory walker. When a route filename uses a [u+XXXX] unicode escape, the hex code portion must contain 4 to 6 hex digits (a valid Unicode code point). This fires during `svelte-kit sync`/dev when a route segment declares an escape whose code is shorter than 4 or longer than 6 characters.

Source

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

		const walk = (depth, id, segment, parent) => {
			const unescaped = id.replace(/\[([ux])\+([^\]]+)\]/gi, (match, type, code) => {
				if (match !== match.toLowerCase()) {
					throw new Error(`Character escape sequence in ${id} must be lowercase`);
				}

				if (!/[0-9a-f]+/.test(code)) {
					throw new Error(`Invalid character escape sequence in ${id}`);
				}

				if (type === 'x') {
					if (code.length !== 2) {
						throw new Error(`Hexadecimal escape sequence in ${id} must be two characters`);
					}

					return String.fromCharCode(parseInt(code, 16));
				} else {
					if (code.length < 4 || code.length > 6) {
						throw new Error(
							`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

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Adjust the unicode escape so the hex code is between four and six characters, e.g. [u+1f600]
  2. Use a plain character in the filename instead of an escape if the code point is simple
  3. Rename the route segment so it matches the documented [u+hex] format
Defensive patterns

Strategy: validation

When it happens

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