sveltejs/kit · error
Character escape sequence in ${id} must be lowercase
Error message
Character escape sequence in ${id} must be lowercase What it means
SvelteKit route folders support character escapes like `[u+1f600]` or `[x41]` to embed Unicode/hex characters in route paths. The escape sequence (including the bracket marker u/x and hex digits) must be entirely lowercase; an uppercase variant such as `[U+1F600]` or `[x+4A]` is rejected during route scanning.
Source
Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:142
const routes_base = posixify(path.relative(cwd, config.files.routes));
const valid_extensions = [...config.extensions, ...config.moduleExtensions];
/** @type {import('types').PageNode[]} */
const nodes = [];
// create route data by processing files in `src/routes`
if (fs.existsSync(config.files.routes)) {
/**
* @param {number} depth
* @param {string} id
* @param {string} segment
* @param {import('types').RouteData | null} parent
*/
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`
);
}View on GitHub (pinned to 03f1687fe6)
Solutions
- Lowercase the entire escape sequence in the directory name, e.g. `[u+1f600]`
- Lowercase both the type marker (`u`/`x`) and all hex digits
- Rename the folder and update any links pointing at the old path
Example fix
// before // src/routes/[U+1F600]/+page.svelte // after // src/routes/[u+1f600]/+page.svelte
Defensive patterns
Strategy: validation
Validate before calling
// validate folder names before committing
const bad = /\[[ux]\+[^\]]*\]/i;
for (const name of routeFolders) {
const m = name.match(bad);
if (m && m[0] !== m[0].toLowerCase()) console.error('Lowercase required:', name);
} Try / catch
try {
await dev();
} catch (e) {
if (String(e.message).includes('must be lowercase')) {
console.error('Lowercase the [u+..]/[x+..] escape in the named route folder');
}
throw e;
} Prevention
- Type escape sequences entirely in lowercase, including hex digits
- Copy folder names from docs exactly instead of retyping
- Disable editor auto-capitalization for route folder names
When it happens
Trigger: Naming a route directory with an uppercase escape: `src/routes/[U+1F4A9]/+page.svelte` or mixed case like `[u+1F600]` — detected by walk() when creating manifest data (dev server start or build).
Common situations: Copying emoji route examples from docs where the hex digits were uppercased; editors auto-capitalizing folder names; manually typing hex codes in uppercase.
Related errors
- Invalid character escape sequence in ${id}
- Hexadecimal escape sequence in ${id} must be two characters
- The "${lookup.get(key)}" and "${route.id}" routes conflict w
- Cannot build with ${JSON.stringify(file)} because Bun treats
- Cannot build with ${JSON.stringify(file)} because Bun treats
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/bd0711ecf69a604f.
Report an issue: GitHub.