{"record":{"id":"6f8257b1278b4b8f","repo":"vercel/next.js","slug":"you-cannot-use-different-slug-names-for-the-same-d","errorCode":null,"errorMessage":"You cannot use different slug names for the same dynamic path ('${previousSlug}' !== '${nextSlug}').","messagePattern":"You cannot use different slug names for the same dynamic path \\('(.+?)' !== '(.+?)'\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/shared/lib/router/utils/sorted-routes.ts","lineNumber":130,"sourceCode":"        )\n      }\n\n      if (segmentName.startsWith('.')) {\n        throw new Error(\n          `Segment names may not start with erroneous periods ('${segmentName}').`\n        )\n      }\n\n      function handleSlug(previousSlug: string | null, nextSlug: string) {\n        if (previousSlug !== null) {\n          // If the specific segment already has a slug but the slug is not `something`\n          // This prevents collisions like:\n          // pages/[post]/index.js\n          // pages/[id]/index.js\n          // Because currently multiple dynamic params on the same segment level are not supported\n          if (previousSlug !== nextSlug) {\n            // TODO: This error seems to be confusing for users, needs an error link, the description can be based on above comment.\n            throw new Error(\n              `You cannot use different slug names for the same dynamic path ('${previousSlug}' !== '${nextSlug}').`\n            )\n          }\n        }\n\n        slugNames.forEach((slug) => {\n          if (slug === nextSlug) {\n            throw new Error(\n              `You cannot have the same slug name \"${nextSlug}\" repeat within a single dynamic path`\n            )\n          }\n\n          if (slug.replace(/\\W/g, '') === nextSegment.replace(/\\W/g, '')) {\n            throw new Error(\n              `You cannot have the slug names \"${slug}\" and \"${nextSlug}\" differ only by non-word symbols within a single dynamic path`\n            )\n          }\n        })","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/shared/lib/router/utils/sorted-routes.ts#L112-L148","documentation":"handleSlug throws when a dynamic segment level already has a slug name and another route at the same level uses a different one (e.g. pages/[post]/x and pages/[id]/x). Only one dynamic parameter name is allowed per level because the router stores a single param value for that position.","triggerScenarios":"Two routes use different slug names for the same dynamic path.","commonSituations":"/blog/[id] and /blog/[postId] both exist; the slug names must match.","solutions":["Use the same slug name for the same dynamic path across routes."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eb377541648e63402a47b38fee00a8d0ce8f8f1","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}