Next.js errors and fixes
Errors from the Next.js React framework: hydration mismatches, App Router client/server boundaries, build-only failures and environment variables.
11 Next.js errors below. Each page shows the exact error text, what it means, likely causes and a step-by-step fix.
- Hydration failed because the initial UI does not match what was rendered on the server
React rendered HTML on the server, then rendered again in the browser and got a different result. - Text content does not match server-rendered HTML
A text node rendered differently on the server and in the browser. - ReferenceError: window is not defined
Code that touches a browser global (window, document, localStorage) ran on the server during server rendering or build, where those globals don't exist.. - You're importing a component that needs useState. It only works in a Client Component
In the App Router every component is a Server Component unless marked otherwise. - async/await is not yet supported in Client Components
A component marked "use client" was declared as an async function. - Module not found: Can't resolve '...'
The bundler could not locate an imported file or package.. - Invalid src prop on next/image, hostname is not configured
next/image only optimizes remote images from hosts you explicitly allow.. - Dynamic server usage: Route couldn't be rendered statically
During build Next.js tried to prerender a route statically, but the route reads request-time data (cookies(), headers(), searchParams), which is only available per request.. - Environment variable is undefined in the browser
Next.js only exposes environment variables to browser code if their name starts with NEXT_PUBLIC_. - Objects are not valid as a React child
JSX tried to render a plain object. - useSearchParams() should be wrapped in a suspense boundary
During a production build of a statically rendered page, a client component calls useSearchParams() without a <Suspense> boundary, so Next.js would have to client-render the whole page..
Related error categories
- React & Next.js rendering errors: 5 pages
- Next.js App Router & config errors: 6 pages
- Vercel build & deploy errors: 6 pages
Not sure which one you have? Take the quiz →
Other platforms
Vercel · Supabase · Stripe · Cursor · Lovable · Bolt · Replit
Get new fixes weekly
No spam. Unsubscribe anytime. Privacy