vercel / vercel/next.js

Default error page affects layout content

Open
#76,710 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Error Handling
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/Netail/repro-next-leaking-default-error-page

To Reproduce
  1. Run yarn install
  2. Run yarn dev
  3. Visit localhost:3000/, on which you can see our "beautiful" custom body styling
  4. Visit a non existing page, e.g. localhost:3000/oops.
Current vs. Expected behavior

NextJS applies their error styling to the body, messing with our custom styling. The content in the layout is affected too, while it should only be constrained to the layout's children in our case.

Provide environment information
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Home
  Available memory (MB): 32702
  Available CPU cores: 8
Binaries:
  Node: 22.11.0
  npm: 10.9.0
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 15.2.0 // Latest available version is detected (15.2.0).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.8.2
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Error Handling

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local)

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction repository: run yarn install and yarn dev, then compare / with /oops; also verify the behavior in next dev and next build. Trace the Error Handling path and layout rendering, and consider the issue done when a non-existent page no longer lets the default error styling affect the layout content or body styling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, react
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.