nextjs - 💡(How to fix) Fix Next.js 16 entering an incorrect URL will cause a memory overflow and restart [15 comments, 9 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#85290Fetched 2026-04-08 02:16:34
View on GitHub
Comments
15
Participants
9
Timeline
19
Reactions
4
Author
Timeline (top)
commented ×15subscribed ×2issue_type_added ×1labeled ×1

Code Example

Operating System:
  Platform: MacOS
  Arch: Apple M4
  Version: 26.0.1
  Available memory (MB): 24576
  Available CPU cores: 10
Binaries:
  Node: 22.15.0
  npm: 10.9.2
  pnpm: 10.14.0
Relevant Packages:
  next: 16.0.0 // Latest available version is detected (16.0.0).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/fundgao/nextjs16-compiling

To Reproduce

  1. Start the application in development (next dev)
  2. Enter the URL of the app router that does not exist on the browser
  3. Next.js Dev Tools displays Compiling until the memory overflows and the system restarts.

Current vs. Expected behavior

  1. Enter the correct URL in the browser and the program will run normally
  2. If you enter the wrong URL in the browser, Next.js Dev Tools displays Compiling until the memory overflows and the system restarts.

The terminal and browser are stuck during compilation.

Provide environment information

Operating System:
  Platform: MacOS
  Arch: Apple M4
  Version: 26.0.1
  Available memory (MB): 24576
  Available CPU cores: 10
Binaries:
  Node: 22.15.0
  npm: 10.9.2
  pnpm: 10.14.0
Relevant Packages:
  next: 16.0.0 // Latest available version is detected (16.0.0).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Not Found

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

next dev (local)

Additional context

I rewrote the 404 page not-found.tsx. But it worked fine before upgrading to Next.js 16.

extent analysis

TL;DR

The issue can likely be fixed by adjusting the Next.js configuration or the custom 404 page to handle non-existent routes without causing a memory overflow.

Guidance

  • Verify that the custom 404 page (not-found.tsx) is correctly implemented and does not contain any infinite loops or recursive function calls that could cause a memory overflow.
  • Check the Next.js documentation for any changes in handling non-existent routes in version 16 and update the configuration accordingly.
  • Try to reproduce the issue with a minimal example to isolate the cause and test potential fixes.
  • Consider adding error handling or a fallback mechanism to prevent the memory overflow when encountering non-existent routes.

Example

No specific code example can be provided without more information about the custom 404 page implementation.

Notes

The issue may be related to changes in Next.js 16, and the custom 404 page implementation might need to be updated to be compatible with the new version.

Recommendation

Apply a workaround by adjusting the custom 404 page implementation to handle non-existent routes without causing a memory overflow, as the issue is likely related to the specific implementation rather than a bug in Next.js 16.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix Next.js 16 entering an incorrect URL will cause a memory overflow and restart [15 comments, 9 participants]