Next.js: Invalid next.config.js options detected: Unrecognized key(s) in object: 'xyz'
next.config.js contains an option Next.js doesn't recognise (typo, wrong version, or moved key).
Invalid next.config.js options detectedUnrecognized key(s) in object⚠ Invalid next.config.js options detected: Expected object, received stringThe key "experimental.appDir" is no longer neededexperimental.serverComponentsExternalPackages has been moved to serverExternalPackages Meaning
Compare the key with the docs for your Next version: options move between experimental and stable (serverActions, appDir, swcMinify, serverComponentsExternalPackages → serverExternalPackages). Remove obsolete keys after upgrading. The message names the bad key and the expected structure.
Common causes
- Typo in a config key
- Option removed/renamed in a newer Next.js
- Option only valid under
experimental - Config written for another version
- Incorrect value type
⚡ Quick fix
- Check the Next.js docs for the option name for your version
- Move keys out of/into
experimentalas documented - Remove stale options after upgrade
Detailed fix by platform
Next.js
npx next infoshows the Next.js version and config issues
How to diagnose
- Key — Named in message?
- Version — Docs for this version?
- Location — experimental?
🔧 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
- 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)
- Features not supported with output: export (headers, redirects, image loader) Next.js: Specified "headers" cannot be used with "output: export" / Image Optimization using the default loader is not compatible with `{ output: 'export' }`
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