vercel / vercel/next.js

global-not-found not served for pages with dynamic paths

Open
#85,446 3 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dynamic Routes Error Handling Not Found
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/matthewmorek/global-not-found-repro.git

To Reproduce
  1. Start the app in dev mode
  2. Navigate to http://localhost:3000/404 or any url that doesn't exist — see global-not-found.tsx being rendered
  3. Navigate to http://localhost:3000/blog — see as per above (because the page doesn't exist)
  4. Navigate to http://localhost:3000/blog/article — page exists and renders
  5. Navigate to http://localhost:3000/blog/any-other-slug — a default 404 is being rendered
Current vs. Expected behavior

Next.js should render a global-not-found.tsx in every instance when this is enabled in configuration and provided in the codebase, since there isn't another not-found.tsx present in any other colocated routes.

Instead, Next.js ignores the global-not-found.tsx and renders a framework default Not Found page. Calling notFound() does not have any effect on this, neither does returning NextResponse.error().

Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Aug 11 21:11:04 PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_ARM64_T6031
  Available memory (MB): 36864
  Available CPU cores: 14
Binaries:
  Node: 22.20.0
  npm: 10.9.3
  Yarn: 1.22.22
  pnpm: 10.18.2
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)

Dynamic Routes, Error Handling, Not Found

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

next dev (local), Vercel (Deployed)

Additional context

This has been present in both latest v15 and v16, regardless of configuration, and is affecting local dev as well as production

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

Run the linked global-not-found-repro app in dev mode and compare the /404, /blog, /blog/article, and /blog/any-other-slug results. Start by tracing dynamic route handling for global-not-found.tsx and not-found.tsx; done means the configured global-not-found.tsx renders for the missing dynamic path instead of the framework default.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, react, typescript
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.