{"record":{"id":"bbf856e54ce53d06","repo":"sveltejs/kit","slug":"invalid-character-escape-sequence-in-id","errorCode":null,"errorMessage":"Invalid character escape sequence in ${id}","messagePattern":"Invalid character escape sequence in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/kit/src/core/sync/create_manifest_data/index.js","lineNumber":146,"sourceCode":"\t/** @type {import('types').PageNode[]} */\n\tconst nodes = [];\n\n\t// create route data by processing files in `src/routes`\n\tif (fs.existsSync(config.files.routes)) {\n\t\t/**\n\t\t * @param {number} depth\n\t\t * @param {string} id\n\t\t * @param {string} segment\n\t\t * @param {import('types').RouteData | null} parent\n\t\t */\n\t\tconst walk = (depth, id, segment, parent) => {\n\t\t\tconst unescaped = id.replace(/\\[([ux])\\+([^\\]]+)\\]/gi, (match, type, code) => {\n\t\t\t\tif (match !== match.toLowerCase()) {\n\t\t\t\t\tthrow new Error(`Character escape sequence in ${id} must be lowercase`);\n\t\t\t\t}\n\n\t\t\t\tif (!/[0-9a-f]+/.test(code)) {\n\t\t\t\t\tthrow new Error(`Invalid character escape sequence in ${id}`);\n\t\t\t\t}\n\n\t\t\t\tif (type === 'x') {\n\t\t\t\t\tif (code.length !== 2) {\n\t\t\t\t\t\tthrow new Error(`Hexadecimal escape sequence in ${id} must be two characters`);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn String.fromCharCode(parseInt(code, 16));\n\t\t\t\t} else {\n\t\t\t\t\tif (code.length < 4 || code.length > 6) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Unicode escape sequence in ${id} must be between four and six characters`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn String.fromCodePoint(parseInt(code, 16));\n\t\t\t\t}\n\t\t\t});","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/sync/create_manifest_data/index.js#L128-L164","documentation":"Inside a route folder's `[u+...]` or `[x+...]` character escape, the hex code must contain only hexadecimal digits. A code with non-hex characters (e.g. `[u+zzzz]`, `[x+g1]`) fails validation and manifest creation throws this error.","triggerScenarios":"Directory names like `src/routes/[x+g1]/` or `[u+12g4]/` — the regex matches the escape shape but the code isn't valid hex, so walk() throws during dev/build route scanning.","commonSituations":"Typos when hand-writing hex escapes; guessing a codepoint instead of looking it up; copying corrupted folder names.","solutions":["Replace the code with valid hex digits only (0-9a-f), e.g. `[u+1f600]`","Look up the actual Unicode codepoint for the character you want","Or drop the escape and use the literal character (or a plain ASCII name) for the folder"],"exampleFix":"// before\n// src/routes/[u+zzzz]/+page.svelte\n\n// after\n// src/routes/[u+1f600]/+page.svelte","handlingStrategy":"validation","validationCode":"function isValidEscape(name) {\n  return /^\\[([x]\\+[0-9a-f]{2}|[u]\\+[0-9a-f]{4,6})\\]$/.test(name);\n}\n// isValidEscape('[u+1f600]') -> true; isValidEscape('[u+zzzz]') -> false","typeGuard":null,"tryCatchPattern":"try {\n  await build();\n} catch (e) {\n  if (String(e.message).includes('Invalid character escape sequence')) {\n    console.error('Use only hex digits 0-9a-f inside [x+..] / [u+..]');\n  }\n  throw e;\n}","preventionTips":["Verify codepoints with a Unicode lookup before naming folders","Use the regex ^[0-9a-f]+$ to self-check codes","Prefer literal characters or ASCII folder names when unsure"],"tags":["routing","routes","unicode","validation"],"backgroundTag":"invalid-route-escape-sequence","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}