vercel / vercel/next.js

Route group layout leaks into root `not-found` page

Open
#96,361 1 comment 4 reactions 1 assignee View on GitHub

@icyJoseph is already working on this.

Since Jul 30, 2026.

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/lsvs/route-group-not-found-bug-reproduction

To Reproduce
  1. Start the app with pnpm dev or pnpm build && pnpm start.
  2. Visit /route-segment/error — the [slug] page calls notFound()
  3. Observe that the not-found page is rendered inside the (route-group) layout.
Current vs. Expected behavior

Current: The not-found page is rendered inside the parent (route-group) layout.

Expected: Since there is no not-found page within that route group, Next.js falls back to the root not-found page, which should render only within the root layout.

Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Tue Apr 21 20:13:48 PDT 2026; root:xnu-11417.140.69.710.16~1/RELEASE_ARM64_T8112
  Available memory (MB): 24576
  Available CPU cores: 8
Binaries:
  Node: 24.18.0
  npm: 11.16.0
  Yarn: N/A
  pnpm: 11.17.0
Relevant Packages:
  next: 16.3.0-preview.10 // Latest available version is detected (16.3.0-preview.10).
  eslint-config-next: N/A
  react: 19.2.8
  react-dom: 19.2.8
  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 build (local), next start (local), Vercel (Deployed), Other (Deployed)

Additional context

The layout hierarchy appears to be inconsistent:

  • / renders only the root layout.
  • /route-segment renders all three layouts.
  • /route-segment/error (which calls notFound()) renders the root layout and the (route-group) layout, but not the nested route layout. ← the bug
  • /route-segment/error/error renders only the root layout again.

This suggests the (route-group) layout leaks into the not-found boundary when notFound() is called.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.