Next.js Discord

Discord Forum

Hydration failed because the server rendered HTML didn't match the client.

Unanswered
Atlantic herring posted this in #help-forum
Open in Discord
Atlantic herringOP
How can I fix this error if it doesn’t show me the exact file?

Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:

- A server/client branch `if (typeof window !== 'undefined')`.
- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
- Date formatting in a user's locale which doesn't match the server.
- External changing data without sending a snapshot of it along with the HTML.
- Invalid HTML tag nesting.

It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.

                                    width={21}
                                    height={21}
+                                   x={160}
-                                   x="200"

2 Replies

Have you tried in incognito mode to discard this isn’t caused by a browser extension?
Also, i would search on my editor where this width={21} height={21} appears and start from there.