🧩Server and browser screens don't match (Hydration)
Hydration failed because the server rendered HTML didn't match the client.
This error happens when the screen the server made ahead of time is different from the one the browser draws again. It's common in frameworks like Next.js.
🤔 Why does it happen?
- Values that change every time, like the current time or a random number, are shown directly on the screen
- The screen was drawn using browser-only values like localStorage or window
- The HTML structure is wrong (like a div inside a p tag)
- A browser extension (such as a translator) changed the page
🔧 Try this
- Check whether it still happens in an incognito window (this tells you if an extension is to blame)
- Show times, random values, and browser-saved values only after the page has loaded (in the browser only)
- Check the HTML structure of the part named in the error
🤖 Ask your AI like this
I get the Hydration error below in Next.js. Please find the parts that are drawn differently on the server and in the browser, and fix them. Fix the cause instead of turning off (suppressing) the warning. [Paste the full error here]
Replace the [ ] parts with your own situation, and paste the error with a few extra lines before and after it.
Related terms
Other errors in this group
- Tried to read an empty value (undefined)
Cannot read properties of undefined - Tried to run something that isn't a function
is not a function - Name not defined
ReferenceError: … is not defined - Response isn't JSON (Unexpected token)
Unexpected token '<' … is not valid JSON - Endless redrawing (Too many re-renders)
Too many re-renders - List items have no key
Each child in a list should have a unique "key" prop - Needs use client (Next.js)
Add the "use client" directive - A function keeps calling itself (call stack exceeded)
RangeError: Maximum call stack size exceeded - Tried to change another component while drawing
Cannot update a component while rendering a different component - Tried to show an object directly on screen
Objects are not valid as a React child - Browser features used on the server (window is not defined)
ReferenceError: window is not defined - A client component was made async
async/await is not yet supported in Client Components - Outside image address not allowed (next/image)
Invalid src prop … hostname is not configured under images - Needs to be wrapped in Suspense (useSearchParams)
useSearchParams() should be wrapped in a suspense boundary - Unhandled async error
Uncaught (in promise) - Couldn't read the date (Invalid Date)
Invalid Date - NaN shows up where a number should be
NaN