vercel/next.js · error · Error

Optional route parameters are not yet supported ("${urlPaths

Error message

Optional route parameters are not yet supported ("${urlPaths[0]}").

What it means

_insert throws when a non-catch-all bracketed segment uses double-bracket (optional parameter) syntax. The Pages Router only supports optional catch-alls ([[...slug]]), not optional plain params like [[param]], so such segments cannot be routed.

Source

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

          this.optionalRestSlugName = segmentName
          // nextSegment is overwritten to [[...]] so that it can later be sorted specifically
          nextSegment = '[[...]]'
        } else {
          if (this.optionalRestSlugName != null) {
            throw new Error(
              `You cannot use both an optional and required catch-all route at the same level ("[[...${this.optionalRestSlugName}]]" and "${urlPaths[0]}").`
            )
          }

          handleSlug(this.restSlugName, segmentName)
          // slugName is kept as it can only be one particular slugName
          this.restSlugName = segmentName
          // nextSegment is overwritten to [...] so that it can later be sorted specifically
          nextSegment = '[...]'
        }
      } else {
        if (isOptional) {
          throw new Error(
            `Optional route parameters are not yet supported ("${urlPaths[0]}").`
          )
        }
        handleSlug(this.slugName, segmentName)
        // slugName is kept as it can only be one particular slugName
        this.slugName = segmentName
        // nextSegment is overwritten to [] so that it can later be sorted specifically
        nextSegment = '[]'
      }
    }

    // If this UrlNode doesn't have the nextSegment yet we create a new child UrlNode
    if (!this.children.has(nextSegment)) {
      this.children.set(nextSegment, new UrlNode())
    }

    this.children
      .get(nextSegment)!

View on GitHub (pinned to 0eb3775416)

Solutions

  1. Remove the optional route parameter syntax; use catch-all segments instead.
Defensive patterns

Strategy: validation

When it happens

Trigger: A route uses optional route parameters syntax.

Common situations: A segment pattern implying optional params that Next.js does not yet support.


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