global-not-found not served for pages with dynamic paths
Nobody has claimed this yet.
- 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
- Start the app in dev mode
- Navigate to
http://localhost:3000/404or any url that doesn't exist — seeglobal-not-found.tsxbeing rendered - Navigate to
http://localhost:3000/blog— see as per above (because the page doesn't exist) - Navigate to
http://localhost:3000/blog/article— page exists and renders - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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