What is the Next.js error overlay?
The error overlay is the development-only panel Next.js shows over your app when something breaks: compile errors, runtime errors, unhandled promise rejections and hydration mismatches. It shows the message, a source-mapped code frame and the component stack, and lets you open the file in your editor.
What it shows
- Build/compile errors (syntax, missing imports) that block rendering.
- Runtime errors from Server and Client Components, with server errors forwarded to the browser.
- Hydration errors with a server versus client diff (
+ Client/- Server, improved in 16.2). Error.causechains up to five levels deep (16.2).- Cache Components insights: blocking routes, random values or timestamps outside a cache, with fix cards linking to docs.
- Several errors at once, with arrows to step through them.
The Next.js DevTools indicator
A small button in the corner opens the DevTools menu with route information (static or dynamic), the issues list, the Navigation Inspector, preferences and the option to hide the indicator. devIndicators: false in config hides the button; the overlay still appears for errors.
Production
The overlay never appears in production. Users see your error.tsx, global-error.tsx, or the built-in error page (redesigned in 16.2). Server errors show a generic message plus a digest that matches server logs.
Tips
- Click a stack frame to open it in your editor (set
REACT_EDITORorEDITORif needed). - If the overlay shows an error from a browser extension, test in a clean profile.
- Fix errors rather than suppressing them; the overlay usually points at the exact line.
Code example
1// next.config.ts2import type { NextConfig } from "next";34const nextConfig: NextConfig = {5 // Move or hide the DevTools indicator; errors still open the overlay in dev6 devIndicators: { position: "bottom-right" },7 // devIndicators: false,8};910export default nextConfig;1112// app/page.tsx - this throws in dev and opens the overlay with a code frame13// export default function Page() {14// const user = undefined as unknown as { name: string };15// return <h1>{user.name}</h1>; // TypeError: Cannot read properties of undefined16// }1718// Open stack frames in your editor:19// REACT_EDITOR=code npm run dev
Practice this question
Open it in the study app to track progress, take notes, listen to the answer and work through the rest of the Next.js set.