| Module not found: Can't resolve 'x' (Next.js build) |
Next.js: Module not found: Can't resolve '@/components/Button' / 'lodash' in '/app/src' |
Webpack/Turbopack couldn't resolve an import — wrong path/alias, missing dependency or case mismatch. |
| Failed to find Server Action |
Next.js: Error: Failed to find Server Action "abc123". This request might be from an older or newer deployment |
The browser called a Server Action ID the current server build doesn't know — usually a version skew after a… |
| ReferenceError: localStorage is not defined |
Next.js: ReferenceError: localStorage is not defined / sessionStorage is not defined |
`localStorage`/`sessionStorage` was read during server rendering. |
| TypeError: Failed to parse URL from /api/... |
Next.js: TypeError: Failed to parse URL from /api/posts (fetch in a Server Component) |
`fetch('/api/x')` with a relative URL works in browsers but not on the server, which has no base URL. |
| Vercel: Command "npm run build" exited with 1 |
Vercel: Error: Command "npm run build" exited with 1 |
The Vercel build step failed; the real reason is printed in the build log above this line. |
| Could not find a production build in the '.next' directory |
Next.js: Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server |
`next start` was run without a prior successful `next build` (or the `.next` folder is missing). |
| 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) |
A cross-origin request to your Next.js API route is blocked because the response lacks CORS headers. |
| 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" |
The same URL is defined in both the `app` and `pages` directories. |
| NEXT_REDIRECT |
Next.js: Error: NEXT_REDIRECT (redirect() inside try/catch) |
redirect() works by throwing a special error; catching it in try/catch (or a .catch) swallows the redirect an… |
| createContext only works in Client Components |
Next.js: You're importing a component that needs createContext. It only works in a Client Component but none of its parents are marked with "use client" |
A context provider (or a lib that uses `createContext`) is used in a Server Component. |
| next.config.js: ES Module / require error |
Next.js: Error [ERR_REQUIRE_ESM]: require() of ES Module next.config.js / SyntaxError: Unexpected token 'export' |
The config file uses ESM syntax in a CommonJS context (or the reverse), so Node can't load it. |
| Used cookies/headers inside a function cached with unstable_cache |
Next.js: Route used `cookies()` inside a function cached with `unstable_cache(...)`. Accessing Dynamic data sources inside a cache scope is not supported |
A cached function reads request-specific data (cookies, headers), which would leak between users. |
| useSearchParams() should be wrapped in a suspense boundary |
Next.js: useSearchParams() should be wrapped in a suspense boundary at page "/". Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout |
A Client Component using `useSearchParams` is statically rendered, so the build needs a Suspense boundary for… |
| Hydration error: <div> cannot be a descendant of <p> |
Next.js: Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p> / In HTML, <p> cannot be a descendant of <p>. This will cause a hydration error |
The rendered HTML has an invalid element nesting, so the browser "fixes" it and React's hydration no longer m… |
| server-only |
Next.js: You're importing a component that needs "server-only". That only works in a Server Component |
A Client Component (or a file it imports) pulls in server-only code — database clients, secrets, next/headers… |
| Vercel FUNCTION_INVOCATION_TIMEOUT (504) |
Vercel: 504 GATEWAY_TIMEOUT — FUNCTION_INVOCATION_TIMEOUT: An error occurred with your deployment |
A Vercel Serverless Function ran longer than its max duration, so Vercel killed it. |
| Failed to fetch font from Google Fonts |
Next.js: ⨯ Failed to download `Inter` from Google Fonts. Using fallback font instead / FetchError: request to https://fonts.googleapis.com failed |
`next/font/google` couldn't download the font at build/dev time (offline, firewall or proxy). |
| Route used revalidatePath during render |
Next.js: Error: Route /blog used "revalidatePath /blog" during render which is unsupported. It must happen outside of renders and cached functions |
`revalidatePath`/`revalidateTag` was called while rendering a page or component, not from an action or route… |
| You cannot use different slug names for the same dynamic path |
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. |
| Image with src must use "width" and "height" properties or "fill" |
Next.js: Image with src "https://example.com/a.jpg" must use "width" and "height" properties or "fill" property |
`next/image` needs dimensions (or `fill`) for remote images so it can reserve space and avoid layout shift. |
| Page is missing generateStaticParams() (output: export) |
Next.js: Page "/blog/[slug]" is missing "generateStaticParams()" so it cannot be used with "output: export" config |
A dynamic route can't be statically exported without telling Next.js which paths to generate. |
| You have a Server Component that imports next/router. Use next/navigation instead |
Next.js: You have a Server Component that imports next/router. Use next/navigation instead |
`next/router` (Pages Router) was imported in an App Router component. |
| Route used params.x — params should be awaited |
Next.js 15: Error: Route "/blog/[slug]" used `params.slug`. `params` should be awaited before using its properties |
In Next.js 15 `params` and `searchParams` are Promises; reading properties synchronously triggers this error/… |
| cookies() should be awaited |
Next.js 15: Route "/x" used `cookies().get('token')`. `cookies()` should be awaited before using its value |
Since Next.js 15, cookies(), headers(), params and searchParams are async — they must be awaited. |
| _next/image 400 / upstream image response failed |
Next.js: ⨯ upstream image response failed for https://example.com/a.jpg 404 / url parameter is not allowed |
The Image Optimization API couldn't fetch or accept the source image (404, blocked host, wrong type). |
| Server actions must be async functions |
Next.js: Error: Server actions must be async functions |
A function marked `"use server"` isn't declared `async`. |
| Invalid next.config.js options detected |
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). |
| ReferenceError: document is not defined |
Next.js: ReferenceError: document is not defined |
Code used the DOM (`document`) while rendering on the server. |
| You are attempting to export "metadata" from a component marked with "use client" |
Next.js: You are attempting to export "metadata" from a component marked with "use client", which is disallowed |
`metadata`/`generateMetadata` can only be exported from Server Components. |
| Dynamic Code Evaluation not allowed in Edge Runtime |
Next.js: Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime |
Code in middleware or an Edge route uses `eval`/`new Function`, which the Edge Runtime forbids. |
| 'sharp' is required to be installed in standalone mode |
Next.js: Error: 'sharp' is required to be installed in standalone mode for the image optimization to function correctly |
In production/standalone builds, Next.js needs the `sharp` package to optimise images. |
| Body exceeded 1 MB limit (Server Actions) |
Next.js: Error: Body exceeded 1 MB limit. To configure the body size limit for Server Actions, see: https://nextjs.org/docs/app/api-reference/next-config-js/serverActions#bodysizelimit |
A Server Action (often a file upload) sent more than the default 1 MB request body. |
| Failed prop type: The prop href expects a string or object in <Link> |
Next.js: Error: Failed prop type: The prop `href` expects a `string` or `object` in `<Link>`, but got `undefined` instead |
`` received `undefined` (or another invalid value), so Next.js can't build the link. |
| Invalid hook call (duplicate React in Next.js) |
Next.js: Error: Invalid hook call. Hooks can only be called inside of the body of a function component — Cannot read properties of null (reading 'useContext') |
Two copies of React are loaded (or React/ReactDOM versions differ), so hooks can't find the active renderer. |
| 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 `/` |
The `config.matcher` regex in middleware contains an unsupported pattern (capturing group) or invalid syntax. |
| Failed to compile: ESLint errors during next build |
Next.js: Failed to compile. ./src/app/page.tsx 12:7 Error: 'x' is assigned a value but never used. @typescript-eslint/no-unused-vars |
`next build` runs ESLint and fails the build on lint errors. |
| Type error during next build |
Next.js: Failed to compile. ./src/app/page.tsx:15:9 Type error: Type 'string | undefined' is not assignable to type 'string' |
TypeScript type checking failed during `next build`, which blocks the deployment. |
| Failed to set Next.js data cache, items over 2MB can not be cached |
Next.js: Failed to set Next.js data cache for https://api.example.com/data, items over 2MB can not be cached (2437412 bytes) |
A `fetch` response was too large for Next.js's data cache (limit 2 MB), so it wasn't cached. |
| next build: JavaScript heap out of memory |
Next.js: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory (during next build) |
Node ran out of memory while building a large Next.js app (or on a small CI/Vercel runner). |
| ERESOLVE: next requires react ^18 (peer dependency conflict) |
npm: ERESOLVE unable to resolve dependency tree — Found: react@19.0.0 / Could not resolve dependency: peer react@"^18.2.0" from some-lib |
A package requires a React version different from the one installed with Next.js. |
| searchParams should be awaited (Next.js 15) |
Next.js 15: Route "/search" used `searchParams.q`. `searchParams` should be awaited |
Page props `searchParams` are a Promise in Next.js 15 and must be awaited. |
| 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 } |
During `next build` a page tried to fetch data from a server (often your own app or an API) that isn't runnin… |
| Only plain objects can be passed to Client Components |
Next.js: Error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported |
A Server Component passed a non-serialisable value (class instance, Date-like object, Mongoose doc, Map) as a… |
| process.env.X is undefined in the browser (NEXT_PUBLIC_) |
Next.js: process.env.API_URL is undefined in Client Component / env variable not available in the browser |
Only variables prefixed `NEXT_PUBLIC_` are exposed to browser code, and they're inlined at build time. |
| ReferenceError: window is not defined |
Next.js: ReferenceError: window is not defined (server-side rendering) |
Code touching the browser's `window` ran on the server during SSR/build, where it doesn't exist. |
| 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' }` |
Static export (`output: 'export'`) can't use server features like rewrites/headers/redirects, default image o… |
| Vercel FUNCTION_PAYLOAD_TOO_LARGE (413) |
Vercel: 413 FUNCTION_PAYLOAD_TOO_LARGE — Request Entity Too Large (4.5 MB limit) |
A request or response exceeded Vercel's 4.5 MB serverless function payload limit. |
| Prisma Client out of date on Vercel (prisma generate) |
Vercel: PrismaClientInitializationError: Prisma has detected that this project was built on Vercel, which caches dependencies. This leads to an outdated Prisma Client |
Vercel cached `node_modules`, so `prisma generate` didn't run and the generated client is stale or missing. |
| The edge runtime does not support Node.js module |
Next.js: The edge runtime does not support Node.js 'crypto' module / A Node.js module is loaded ('fs') which is not supported in the Edge Runtime |
Middleware or an Edge route imported a Node.js built-in (`fs`, `crypto`, `path`, `net`) that isn't available… |
| Edge Function size limit exceeded |
Vercel: The Edge Function "middleware" size is 1.2 MB and your plan size limit is 1 MB. Learn More: https://vercel.link/edge-function-size |
Your middleware/Edge Function bundle is larger than the plan's size limit. |
| ERR_TOO_MANY_REDIRECTS (Next.js middleware) |
Browser: This page isn't working — redirected you too many times (ERR_TOO_MANY_REDIRECTS) with Next.js middleware / trailing slash |
Middleware (or config redirects) keeps redirecting between the same URLs. |
| Invalid <Link> with <a> child. Please remove <a> |
Next.js 13+: Error: Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior> |
Since Next.js 13 `` renders its own ``, so nesting your own `` is invalid. |
| No HTTP methods exported in route.ts |
Next.js: Error: No HTTP methods exported in '/app/api/users/route.ts'. Export a named export for each HTTP method (GET, POST...) |
A Route Handler file exports no recognised HTTP method function. |