← All errors

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.

Updated .

Next.js errors at a glance

ErrorMost common causeFirst thing to try
Hydration failed because the initial UI does not match what was rendered on the serverUsing browser-only values during render (window, localStorage, Date.now(), Math.random()).Check the console for the specific element React complains about and fix invalid nesting first.
Text content does not match server-rendered HTMLDates/times formatted with the user's locale or time zone.Format dates with an explicit time zone and locale so server and client agree.
ReferenceError: window is not definedAccessing window/document at the top level of a module or during render.Access browser globals inside useEffect, which only runs in the browser.
You're importing a component that needs useState. It only works in a Client ComponentUsing React hooks in a file under app/ without the "use client" directive.Add the directive as the very first line of the file that uses hooks.
async/await is not yet supported in Client ComponentsAdding "use client" to a page that does `export default async function`.Option A.
Module not found: Can't resolve '...'The package isn't installed (or is only installed locally, not in package.json).Install the package and make sure it is saved to package.json.
Invalid src prop on next/image, hostname is not configuredLoading an image from a new domain (e.g.Add the host to remotePatterns in next.config.
Dynamic server usage: Route couldn't be rendered staticallyCalling cookies() or headers() in a page or layout that Next.js assumes is static.Mark the route as dynamic.
Environment variable is undefined in the browserVariable not prefixed with NEXT_PUBLIC_.Rename the variable for client use (never do this for secrets).
Objects are not valid as a React childRendering {user} instead of {user.name}.Render a specific field or convert to a string.
useSearchParams() should be wrapped in a suspense boundaryCalling useSearchParams() in a component rendered by a static page without Suspense.Wrap the component that uses search params in Suspense.

All Next.js fixes

Related error categories

Not sure which one you have? Take the quiz →

Other platforms

Vercel · Supabase · Stripe · Cursor · Lovable · Bolt · Rocket.new · Replit

Get new fixes weekly

No spam. Unsubscribe anytime. Privacy