Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Nested dynamic route segment doesn't redirect to root not-found.js | GoodFirstPicks

Nested dynamic route segment doesn't redirect to root not-found.js

vercel/next.js 8 comments 1mo ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeNext.jsTypeScriptReact

Why this is a good first issue

Dynamic routing in nested app directory paths does not redirect to not-found.js as expected.

AI Summary

The issue involves nested dynamic routes in the app directory not correctly redirecting to the not-found.js page, instead throwing an error. The problem is reproducible and affects multiple users, but the exact cause and solution are not immediately clear, requiring deeper understanding of Next.js routing and app directory behavior.

Issue Description

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Wed Aug 25 23:20:18 UTC 2021
    Binaries:
      Node: 18.14.2
      npm: 9.6.4
      Yarn: 1.22.19
      pnpm: N/A
    Relevant packages:
      next: 13.3.0
      eslint-config-next: 13.3.0
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true)

Link to the code that reproduces this issue

n/a

To Reproduce

Using the app directory, create several folders for path segments with the last ending in a dynamic route. Here is my example:

app/(site)/memberships/benefits/[slug]/page.js

I have several other similar to this

Describe the Bug

When a dynamic path is nested within another folder path, the notFound() function does not redirect to the /not-found.js page. It instead throws an error. All other paths work fine. This is true whether the nested dynamic route is [slug] or [...slug]

Expected Behavior

I expect that the notFound() function should redirect to the not-found.js page like the other dynamic routes in this same project do.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!

Risk Flags

  • dynamic routing
  • app directory
  • not-found.js behavior
Loading labels...

Details

Points10 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno