vercel/next.js · error · Error

You cannot have the same slug name "${nextSlug}" repeat with

Error message

You cannot have the same slug name "${nextSlug}" repeat within a single dynamic path

What it means

handleSlug throws when the identical slug name is declared more than once within a single dynamic path (e.g. [slug] appearing twice at the same level across routes). Duplicate parameter names would produce conflicting values for the same param key.

Source

Thrown at packages/next/src/shared/lib/router/utils/sorted-routes.ts:138

      function handleSlug(previousSlug: string | null, nextSlug: string) {
        if (previousSlug !== null) {
          // If the specific segment already has a slug but the slug is not `something`
          // This prevents collisions like:
          // pages/[post]/index.js
          // pages/[id]/index.js
          // Because currently multiple dynamic params on the same segment level are not supported
          if (previousSlug !== nextSlug) {
            // TODO: This error seems to be confusing for users, needs an error link, the description can be based on above comment.
            throw new Error(
              `You cannot use different slug names for the same dynamic path ('${previousSlug}' !== '${nextSlug}').`
            )
          }
        }

        slugNames.forEach((slug) => {
          if (slug === nextSlug) {
            throw new Error(
              `You cannot have the same slug name "${nextSlug}" repeat within a single dynamic path`
            )
          }

          if (slug.replace(/\W/g, '') === nextSegment.replace(/\W/g, '')) {
            throw new Error(
              `You cannot have the slug names "${slug}" and "${nextSlug}" differ only by non-word symbols within a single dynamic path`
            )
          }
        })

        slugNames.push(nextSlug)
      }

      if (isCatchAll) {
        if (isOptional) {
          if (this.restSlugName != null) {
            throw new Error(

View on GitHub (pinned to 0eb3775416)

Solutions

  1. Rename one of the repeated slug names within the dynamic path.
Defensive patterns

Strategy: validation

When it happens

Trigger: The same slug name repeats within one dynamic path.

Common situations: A route like /[id]/[id] reusing the same slug name twice.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/a16a4d13c56bad40. Report an issue: GitHub.