Invalid next.config.js options detected Next.js Origin: On your device OSI layer 7 · Application Last updated 5 Nov 2026

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).

Exact message you may see 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
Seen on: Next.js Node.js

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

  1. Check the Next.js docs for the option name for your version
  2. Move keys out of/into experimental as documented
  3. Remove stale options after upgrade

Detailed fix by platform

Next.js

  1. npx next info shows the Next.js version and config issues

How to diagnose

  1. Key — Named in message?
  2. Version — Docs for this version?
  3. 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:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

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" (Next.js)Conflicting app and p…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) (Next.js)CORS error calling Ne…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' }` (Next.js)Features not supporte…Middleware matcher: Capturing groups are not allowed — Next.js: Error: Invalid middleware found. Capturing groups are not allowed in matcher / `matcher` values must start with `/` (Next.js)Middleware matcher: C…next build: fetch failed ECONNREFUSED (build-time API) — Next.js: Error occurred prerendering page "/blog" TypeError: fetch failed { cause: Error: connect ECONNREFUSED 127.0.0.1:3000 } (Next.js)next build: fetch fai…next build: JavaScript heap out of memory — Next.js: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory (during next build) (Next.js)next build: JavaScrip…next.config.js: ES Module / require error — Next.js: Error [ERR_REQUIRE_ESM]: require() of ES Module next.config.js / SyntaxError: Unexpected token 'export' (Next.js)next.config.js: ES Mo…next/image hostname — Error: Invalid src prop on `next/image`, hostname "x" is not configured under images in your `next.config.js` (React)next/image hostnameInvalid n…

Explore the map of this error Full error map →

🧠 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.