Next.js 15: Optional catch-all route conflicts with static route
Error: You cannot define a route with the same specificity as an optional catch-all route.
"app/dashboard/[[...slug]]/page.js" and "app/dashboard/page.js" would both resolve to "/dashboard".
Immediate Remediation
bash
Remove the static page file that conflicts with the optional catch-all: rm app/dashboard/page.js (or delete the optional catch-all folder if the static route is canonical).
Root Cause Analysis
Next.js treats optional catch-all routes ([[...slug]]) as matching the parent path with zero segments, so a static page at the same path creates an ambiguous route conflict that the router cannot resolve deterministically.
Verification & Guardrails
- This error occurs at build time, not runtime, so it is caught in CI.
- If you need both, restructure to app/dashboard/page.js and app/dashboard/items/[[...slug]]/page.js.
- Check for hidden page.js/index.js files in the same directory before deleting.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.