vercel / vercel/next.js

console.error in catch block triggers ErrorBoundary in strict mode when using Pages Router

Open
#75,299 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Pages Router
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/lukasb/error-repro

To Reproduce
  1. npm run dev
  2. navigate to app
Current vs. Expected behavior

For pages router:
Current: ErrorBoundary is shown
Expected: ErrorBoundary is not shown, since error was caught

For app router:
Current: "1 error" badge shown
Expected: no badge shown, since error was caught

Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:15 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 20.18.1
  npm: 10.8.2
  Yarn: 1.22.5
  pnpm: 9.4.0
Relevant Packages:
  next: 15.1.4 // There is a newer version (15.1.6) available, upgrade recommended!
  eslint-config-next: 15.1.4
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.7.3
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Pages Router

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

next dev (local)

Additional context

see investigation and patches by @icyJoseph here: https://github.com/vercel/next.js/discussions/75060#discussioncomment-11935972

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 error-repro project and run npm run dev, then navigate to the app to observe the Pages Router behavior. Read the investigation and patches linked in Discussion #75060; done means a caught error does not show the ErrorBoundary in the Pages Router or an error badge in the App Router.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.