nextjs - ✅(Solved) Fix Poor error message when dynamicParams = false blocks child routes [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#87738Fetched 2026-04-08 02:06:16
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
1
Author
Participants
Timeline (top)
labeled ×3issue_type_added ×1subscribed ×1

Error Message

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)

Root Cause

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.

Fix Action

Fix / Workaround

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

PR fix notes

PR #1: Improve NoFallbackError message for dynamicParams=false misses

Description (problem / solution / changelog)

<!-- CURSOR_AGENT_PR_BODY_BEGIN -->

What?

  • Replaces the internal NoFallbackError message (Internal: NoFallbackError) with a user-facing explanation when a route parameter is rejected because dynamicParams = false.
  • Extends test/e2e/app-dir/app-static/app-static.test.ts to assert that next start output no longer includes the internal string and now includes the improved message.

Why?

Issue #87738 reports that the current output is too opaque for users. It exposes an internal control-flow marker instead of explaining the configuration mismatch.

How?

  • Updated packages/next/src/shared/lib/no-fallback-error.external.ts message text.
  • Added a regression assertion in the existing dynamicParams false e2e test around invalid params.

This fix intentionally keeps scope small (2 files) and does not change routing behavior (still returns 404); it only improves the surfaced message.

Validation

  • Ran:
    • NEXT_SKIP_ISOLATE=1 NEXT_TEST_MODE=start pnpm testheadless test/e2e/app-dir/app-static/app-static.test.ts -t "should handle dynamicParams: false correctly"
  • Result: passing (1 passed, 110 skipped)
  • Before/after proof from captured logs of the same scenario:
    • Before: Error: Internal: NoFallbackError
    • After: Error: A dynamic route parameter was not generated by \generateStaticParams` while `dynamicParams = false`.`

UI / Dev UX proof (before vs after)

<p> [Before: internal NoFallbackError output](https://cursor.com/agents/bc-d0e8ad78-9dd9-4ecd-9532-f6c06bbbf68d/artifacts?path=%2Fopt%2Fcursor%2Fartifacts%2Fscreenshots%2Fbefore-no-fallback-error-message.png) </p> <p> [After: user-facing dynamicParams=false message](https://cursor.com/agents/bc-d0e8ad78-9dd9-4ecd-9532-f6c06bbbf68d/artifacts?path=%2Fopt%2Fcursor%2Fartifacts%2Fscreenshots%2Fafter-no-fallback-error-message.png) </p>

Edge cases / limitations

  • The message is generic and intentionally avoids path-specific context.
  • Existing code paths that throw NoFallbackError now use this clearer shared message.

Fixes #87738

<!-- NEXT_JS_LLM_PR -->

<sub>To show artifacts inline, <a href="https://cursor.com/dashboard/cloud-agents#team-pull-requests">enable</a> in settings.</sub>

<!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-d0e8ad78-9dd9-4ecd-9532-f6c06bbbf68d"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-d0e8ad78-9dd9-4ecd-9532-f6c06bbbf68d"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

Changed files

  • packages/next/src/shared/lib/no-fallback-error.external.ts (modified, +2/-1)
  • test/e2e/app-dir/app-static/app-static.test.ts (modified, +8/-0)

PR #92936: NoFallbackError: replace internal-jargon message with actionable guidance

Description (problem / solution / changelog)

What?

Replace the NoFallbackError message from the unhelpful "Internal: NoFallbackError" with one that names the most common cause and links to the relevant docs.

Why?

NoFallbackError is an internal control-flow signal — the framework normally catches it and turns it into a 404 response, so the message is rarely seen by end users. But when it does leak to a server log (as reproduced in #87738 — a parent app router segment with dynamicParams: false plus a request whose params aren't in generateStaticParams()), the user sees:

``` Error: Internal: NoFallbackError at <anonymous> (.next/server/chunks/ssr/babdf1ac..js:2:1128) ... ```

…which gives them no idea what went wrong, what to look for in their app, or where to read more. They have to chase it through Next.js source code to figure out the connection to dynamicParams.

How?

Replace the static message with one that names the common cause and links to the route segment config docs:

``` No fallback was rendered for this route, so the request returned a 404. A common cause is dynamicParams: false on a parent segment combined with a request whose params were not returned by generateStaticParams(). See https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamicparams ```

Also switched from super(); this.message = ... (the old form) to the conventional super(message).

The error message is the only public surface of the class — no behavior change for the framework's normal catch-and-handle flow. Every instanceof NoFallbackError check in base-server.ts, next-server.ts, router-server.ts, etc., still works exactly as before.

Scope

Just the message. The PR deliberately does not try to enrich NoFallbackError with per-call context (which segment / route / params triggered it). That would require plumbing through every throw site (see grep for new NoFallbackError() in app-page.ts, app-route.ts, pages-handler.ts) and is a separate, larger change. The static message is already a substantial improvement on the no-info-at-all status quo.

Test plan

Added test/unit/no-fallback-error.test.ts with two cases:

  • The class is an Error subclass (sanity check).
  • The message contains dynamicParams, generateStaticParams, and a nextjs.org/docs/ URL — locks in the actionable wording so a future edit can't silently regress to "Internal: NoFallbackError".

npx jest test/unit/no-fallback-error.test.ts → 2 passed.

Fixes #87738

Changed files

  • packages/next/src/shared/lib/no-fallback-error.external.ts (modified, +18/-2)
  • test/unit/no-fallback-error.test.ts (added, +18/-0)

Code Example

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)

---

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

---

╰─ 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
RAW_BUFFERClick to expand / collapse

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

extent analysis

TL;DR

Change dynamicParams = false to dynamicParams = true in the parent layout (app/[locale]/layout.tsx) to allow child routes to accept dynamic parameters.

Guidance

  • Verify that the dynamicParams setting is indeed the cause of the issue by checking the parent layout file (app/[locale]/layout.tsx) for the export const dynamicParams = false line.
  • Update the dynamicParams setting to true in the parent layout to enable dynamic parameters for child routes.
  • Alternatively, add all possible shareId values to generateStaticParams if setting dynamicParams to true is not desirable.
  • After making the change, re-run npm run build && npm run start and navigate to http://localhost:3000/en/shared/test-123 to verify that the route works as expected.

Example

// app/[locale]/layout.tsx
export const dynamicParams = true; // Update this line

Notes

This solution assumes that the issue is solely caused by the dynamicParams setting in the parent layout. If the issue persists after making this change, further investigation may be necessary.

Recommendation

Apply workaround: Change dynamicParams = false to dynamicParams = true in the parent layout, as this is the most straightforward solution to enable dynamic parameters for child routes.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - ✅(Solved) Fix Poor error message when dynamicParams = false blocks child routes [2 pull requests, 1 participants]