Skip to content

root not-found page not displayed when inside a route group #73380

@stefanprobst

Description

@stefanprobst

Link to the code that reproduces this issue

https://github.com/stefanprobst/issue-next-not-found-route-group

To Reproduce

  1. clone the repo
  2. pnpm install && pnpm build && pnpm start
  3. open http://localhost:3000/not-existing-route
  4. see the built-in default not-found page being displayed, not the one from /app/(app)/not-found.tsx

Current vs. Expected behavior

the custom root not-found page is not shown for e.g. http://localhost:3000/not-existing-route because it lives in a route group (instead the built-in default 404 page is shown):

└── app
    └── (app)
        ├── layout.tsx
        ├── not-found.tsx
        └── page.tsx

it only works correctly when getting rid of the route group (check out the no-route-group branch)

└── app
    ├── layout.tsx
    ├──	not-found.tsx
    └── page.tsx

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #49-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov  4 02:06:24 UTC 2024
  Available memory (MB): 32041
  Available CPU cores: 4
Binaries:
  Node: 22.11.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 9.14.2
Relevant Packages:
  next: 15.0.4-canary.32 // Latest available version is detected (15.0.4-canary.32).
  eslint-config-next: N/A
  react: 19.0.0-rc-b01722d5-20241114
  react-dom: 19.0.0-rc-b01722d5-20241114
  typescript: 5.7.2
Next.js Config:
  output: N/A

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

Navigation

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

next dev (local), next start (local)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.bugIssue was opened via the bug report template.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions