{"record":{"id":"6a22ab18025a97b5","repo":"sveltejs/kit","slug":"invalid-route-id-a-rest-route-segment-is-alwa","errorCode":null,"errorMessage":"Invalid route ${id} — a rest route segment is always optional, remove the outer square brackets","messagePattern":"Invalid route (.+?) — a rest route segment is always optional, remove the outer square brackets","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/kit/src/core/sync/create_manifest_data/index.js","lineNumber":186,"sourceCode":"\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}\n\n\t\t\tconst { pattern, params } = parse_route_id(id);\n\n\t\t\t/** @type {import('types').RouteData} */\n\t\t\tconst route = {\n\t\t\t\tid,\n\t\t\t\tparent,\n\n\t\t\t\tsegment,\n\t\t\t\tpattern,\n\t\t\t\tparams,\n\n\t\t\t\tlayout: null,\n\t\t\t\terror: null,\n\t\t\t\tleaf: null,","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/sync/create_manifest_data/index.js#L168-L204","documentation":"Route ID validation error: the id contains '[[...', i.e. a rest parameter written with double brackets like [[...slug]]. Rest parameters are inherently optional in SvelteKit, so the extra optional-marking brackets are redundant and invalid; the correct form is [...slug]. Fires during route walking in sync/dev.","triggerScenarios":"Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:186 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the outer square brackets: rename [[...slug]] to [...slug]","Keep single-bracket rest parameters, since they are always optional by design"],"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"}