Next.js: Error: You cannot use different slug names for the same dynamic path ('id' !== 'slug')
Sibling dynamic folders at the same level use different parameter names.
You cannot use different slug names for the same dynamic path ('id' !== 'slug')Error: You cannot use different slug names for the same dynamic pathdifferent slug names for the same dynamic path Meaning
At one path level only one dynamic segment name is allowed: [id] and [slug] can't coexist. Rename them to the same name, nest them differently, or merge routes. After renaming restart next dev and clear .next.
Common causes
app/posts/[id]andapp/posts/[slug]both present- Pages and app routes with different names for the same segment
- Leftover renamed folder
- Catch-all conflicts
- Copy-paste folder
⚡ Quick fix
- Rename to a single consistent param name
- Remove the stale folder
- Restart dev server and delete
.next
Detailed fix by platform
Linux
rm -rf .next && npm run devafter renaming folders
How to diagnose
- Folders — Both [id] and [slug]?
- Level — Same parent?
- Cache — .next cleared?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- [Vue Router warn]: No match found for location with path Vue Router: [Vue Router warn]: No match found for location with path "/users/42"
- Conflicting app and page file was found Next.js: ⨯ Conflicting app and page file was found, please remove the conflicting files to continue: "pages/index.tsx" - "app/page.tsx"
- CORS error calling Next.js API route / route handler Browser: Access to fetch at 'https://api.example.com/api/data' from origin 'https://app.example.com' has been blocked by CORS policy (Next.js route handler)
Most viewed in Next.js
- NEXT_REDIRECT Next.js: Error: NEXT_REDIRECT (redirect() inside try/catch)
- server-only Next.js: You're importing a component that needs "server-only". That only works in a Server Component
- cookies() should be awaited Next.js 15: Route "/x" used `cookies().get('token')`. `cookies()` should be awaited before using its value
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026