vercel / vercel/next.js

Poor error message when dynamicParams = false blocks child routes

Open
#87,738 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dynamic Routes Error Handling Pages Router
Dominant language
JavaScript
Stars
142k
Forks
32.5k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/tavurth/nextjs-dynamicparams-bugtook

To Reproduce
  1. Clone the reproduction repository
  2. Run npm install (or bun i)
  3. Run npm run build && npm run start
  4. Navigate to http://localhost:3000/en/shared/test-123
  5. Observe 404 error with NoFallbackError in terminal
Current vs. Expected behavior

Current vs. Expected behavior
Current: Route returns 404 with unhelpful error message in console:

Error: Internal: NoFallbackError
    at <anonymous> (.next/server/chunks/ssr/_babdf1ac._.js:2:1128)
    at n (.next/server/chunks/ssr/_babdf1ac._.js:2:419)
    at responseGenerator (.next/server/chunks/ssr/_babdf1ac._.js:2:2770)

Expected: Either the route should work, or a clear error message should be displayed:

Error: Dynamic route segment [shareId] is blocked by parent configuration
  → app/[locale]/layout.tsx has `export const dynamicParams = false`
  → This prevents child routes from accepting dynamic parameters not in generateStaticParams
  → Solution: Set `dynamicParams = true` in parent layout, or add all shareId values to generateStaticParams

Root Cause: The parent layout (app/[locale]/layout.tsx) has export const dynamicParams = false, which inherits to all child routes. This blocks the child route (app/[locale]/shared/[shareId]/page.tsx) from accepting dynamic shareId parameters. While this is correct behavior, the error message provides no indication of the actual problem or how to fix it.

Workaround: Change dynamicParams = false to dynamicParams = true in the parent layout.

Provide environment information
╰─ Will npx --no-install next info
/bin/sh: pnpm: command not found

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041
  Available memory (MB): 36864
  Available CPU cores: 14
Binaries:
  Node: 24.6.0
  npm: 11.5.1
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 16.1.1 // Latest available version is detected (16.1.1).
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Dynamic Routes, Error Handling, Pages Router

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

next start (local)

Additional context

No response

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

Clone the linked reproduction, run npm install, then npm run build && npm run start and visit /en/shared/test-123. Read app/[locale]/layout.tsx and app/[locale]/shared/[shareId]/page.tsx to confirm how dynamicParams and generateStaticParams interact. Done means the blocked child-route behavior produces a clear diagnostic or the documented route behavior is corrected, with coverage for this reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, react
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.