{"record":{"id":"fee266d8da2225e8","repo":"sveltejs/kit","slug":"invalid-route-id-brackets-are-unbalanced","errorCode":null,"errorMessage":"Invalid route ${id} — brackets are unbalanced","messagePattern":"Invalid route (.+?) — brackets are unbalanced","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/kit/src/core/sync/create_manifest_data/index.js","lineNumber":171,"sourceCode":"\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});\n\n\t\t\tif (/\\]\\[/.test(unescaped)) {\n\t\t\t\tthrow new Error(`Invalid route ${id} — parameters must be separated`);\n\t\t\t}\n\n\t\t\tif (count_occurrences('[', id) !== count_occurrences(']', id)) {\n\t\t\t\tthrow new Error(`Invalid route ${id} — brackets are unbalanced`);\n\t\t\t}\n\n\t\t\tif (/#/.test(segment)) {\n\t\t\t\t// Vite will barf on files with # in them\n\t\t\t\tthrow new Error(`Route ${id} should be renamed to ${id.replace(/#/g, '[x+23]')}`);\n\t\t\t}\n\n\t\t\tif (/\\[\\.\\.\\.[\\w-]+\\]\\/\\[\\[/.test(id)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid route ${id} — an [[optional]] route segment cannot follow a [...rest] route segment`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (/\\[\\[\\.\\.\\./.test(id)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid route ${id} — a rest route segment is always optional, remove the outer square brackets`\n\t\t\t\t);\n\t\t\t}","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/sync/create_manifest_data/index.js#L153-L189","documentation":"Route ID validation error: the number of '[' characters in the route id does not equal the number of ']' characters, so a dynamic/optional/rest parameter group is opened but never closed (or vice versa), e.g. a directory named [slug or [slug]]. Fires while walking src/routes during sync/dev.","triggerScenarios":"Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:171 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename the route file or directory so every '[' has a matching ']'","Check for accidentally truncated parameter names in nested directories"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}