nextjs - 💡(How to fix) Fix `global-not-found` page not used for `notFound()` in root layout [2 comments, 3 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#86095Fetched 2026-04-08 02:12:37
View on GitHub
Comments
2
Participants
3
Timeline
8
Reactions
1
Timeline (top)
commented ×2subscribed ×2cross-referenced ×1issue_type_added ×1

Code Example

Operating System:
  Platform: linux
  Arch: x64
  Version: #35~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Oct 14 13:55:17 UTC 2
  Available memory (MB): 31401
  Available CPU cores: 16
Binaries:
  Node: 24.11.0
  npm: 11.6.1
  Yarn: N/A
  pnpm: 10.20.0
Relevant Packages:
  next: 16.0.2-canary.17 // Latest available version is detected (16.0.2-canary.17).
  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/stefanprobst/issue-next-global-not-found

To Reproduce

  1. clone repo from https://github.com/stefanprobst/issue-next-global-not-found
  2. pnpm install
  3. pnpm dev
  4. go to http://localhost:3000/xyz
  5. expected to see content from global-not-found but instead see default builtin 404 page

Current vs. Expected behavior

global-not-found should be used for all 404

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #35~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Oct 14 13:55:17 UTC 2
  Available memory (MB): 31401
  Available CPU cores: 16
Binaries:
  Node: 24.11.0
  npm: 11.6.1
  Yarn: N/A
  pnpm: 10.20.0
Relevant Packages:
  next: 16.0.2-canary.17 // Latest available version is detected (16.0.2-canary.17).
  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), next start (local)

Additional context

No response

extent analysis

TL;DR

  • The issue can likely be resolved by correctly configuring the getStaticPaths or getServerSideProps functions in Next.js to handle 404 routes and serve the global-not-found page.

Guidance

  • Review the Next.js documentation on custom 404 pages to ensure that the global-not-found page is properly set up and configured.
  • Verify that the next.config.js file does not contain any custom configurations that might be overriding the default 404 behavior.
  • Check the file structure and naming conventions to ensure that the global-not-found page is in the correct location and named correctly according to Next.js conventions.
  • Test the application with different routes to see if the issue is specific to certain URLs or if it's a global problem.

Example

No specific code example can be provided without modifying the original codebase, but ensuring that the pages directory contains a 404.js or _app.js with the correct import and rendering of the global-not-found component is crucial.

Notes

The provided information does not include the actual code for the global-not-found page or the Next.js configuration, making it difficult to provide a precise fix. However, following Next.js guidelines for custom 404 pages should resolve the issue.

Recommendation

  • Apply workaround: Configure the getStaticPaths or getServerSideProps functions correctly to handle 404 routes, as this seems to be the most direct approach to resolving the issue given the information provided.

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