Next.js Discord

Discord Forum

Optional Catch all segments throw error

Unanswered
AM posted this in #help-forum
Open in Discord
AMOP
I have following segment stucture
/app
  /cars
    /[[...id]]
      page.tsx
  page.tsx


but when i try to compile i get this error:

Error: You cannot define a route with the same specificity as a optional catch-all route ("/cars" and "/cars[[...id]]").

i see other examples like this:

app/shop/[[...slug]]/page.js

which should be equialent of:

app/cars/[[...id]]/page.tsx

but aint working for some reason

0 Replies