nextjs - ✅(Solved) Fix Route "/" did not produce a static shell and Next.js was unable to determine a reason. This is a bug in Next.js. [1 pull requests, 2 comments, 3 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#86664Fetched 2026-04-08 02:09:54
View on GitHub
Comments
2
Participants
3
Timeline
11
Reactions
3
Timeline (top)
labeled ×3commented ×2referenced ×2subscribed ×2

Fix Action

Fixed

PR fix notes

PR #5: Fix bug with empty static shell in generateMetadata using runtime data

Description (problem / solution / changelog)

What?

Fixes a bug that caused a generic error when generateMetadata uses runtime data and the static shell is empty. The error message has been improved to highlight the presence of runtime data in generateMetadata.

Why?

Improves debugging by providing a specific error message instead of a generic one, ensuring developers can identify the issue accurately.

How?

  • Added a dynamicMetadata check in:
    • getStaticShellDisallowedDynamicReasons when prelude === PreludeState.Empty.
    • throwIfDisallowedDynamic when prelude === PreludeState.Empty.
  • Added a test case to confirm these fixes.

Closes NEXT- Fix

Changed files

  • packages/next/src/server/app-render/dynamic-rendering.ts (modified, +9/-0)
  • test/e2e/app-dir/cache-components-errors/cache-components-dynamic-metadata-empty-shell.test.ts (added, +157/-0)
  • test/e2e/app-dir/cache-components-errors/fixtures/dynamic-metadata-empty-shell/app/dynamic-metadata-connection-empty-shell/page.tsx (added, +18/-0)
  • test/e2e/app-dir/cache-components-errors/fixtures/dynamic-metadata-empty-shell/app/layout.tsx (added, +11/-0)
  • test/e2e/app-dir/cache-components-errors/fixtures/dynamic-metadata-empty-shell/next.config.js (added, +9/-0)

Code Example

cacheComponents: true,
     htmlLimitedBots: /.*/,

---

export async function generateMetadata(): Promise<Metadata> {
     await connection()

     return {
       title: 'My App',
       description: 'My App Description',
     }
   }

---

npx --no-install next info

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.1.0: Mon Oct 20 19:34:05 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 12
Binaries:
  Node: 20.19.4
  npm: 10.8.2
  Yarn: N/A
  pnpm: 10.14.0
Relevant Packages:
  next: 16.0.5 // Latest available version is detected (16.0.5).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  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/IskanderMustafin/nextjs-metadata-runtime-bug

To Reproduce

  1. Create a new app: pnpm create next-app@latest next-runtime-data-test --yes
  2. In next.config.ts, set:
     cacheComponents: true,
     htmlLimitedBots: /.*/,
  1. In app/page.tsx add generateMetadata that accesses runtime data (like await searchParams or await connection()) :
   export async function generateMetadata(): Promise<Metadata> {
     await connection()

     return {
       title: 'My App',
       description: 'My App Description',
     }
   }
  1. Run pnpm dev and open / in the browser.
<img width="744" height="819" alt="Image" src="https://github.com/user-attachments/assets/adce537a-b936-4085-8074-0e3a6fc036ee" /> <img width="1023" height="406" alt="Image" src="https://github.com/user-attachments/assets/ef5e027b-13aa-4232-967a-8c18ff536098" />

Current vs. Expected behavior

In the dev server logs, Next.js repeatedly prints:

Route "/" did not produce a static shell and Next.js was unable to determine a reason. This is a bug in Next.js.

generateMetadata should be allowed to use runtime data like connection() even when cacheComponents: true and htmlLimitedBots: /.*/ are enabled.

Provide environment information

npx --no-install next info

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.1.0: Mon Oct 20 19:34:05 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 12
Binaries:
  Node: 20.19.4
  npm: 10.8.2
  Yarn: N/A
  pnpm: 10.14.0
Relevant Packages:
  next: 16.0.5 // Latest available version is detected (16.0.5).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

create-next-app, Metadata, cacheComponents

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

next dev (local), next build (local), next start (local)

Additional context

The issue only appears when all three are combined:

  • cacheComponents: true
  • htmlLimitedBots: /.*/ (disabling streaming metadata)
  • generateMetadata calling any runtime data ( e.g. await connection())

Problem happens with any Next.js 16+ (I tried up until 16.0.5)

extent analysis

TL;DR

Disable cacheComponents or modify generateMetadata to not use runtime data when htmlLimitedBots is enabled to workaround the Next.js bug.

Guidance

  • Verify that the issue is resolved by disabling cacheComponents in next.config.ts and check if the error message disappears from the dev server logs.
  • Consider modifying generateMetadata to use a different approach that doesn't rely on runtime data, such as pre-computing the metadata or using a different data source.
  • If using runtime data in generateMetadata is necessary, try disabling htmlLimitedBots or setting it to a more specific regex to see if it resolves the issue.
  • Check the Next.js documentation and issues for any updates or workarounds related to this bug, as it may be addressed in a future version.

Notes

The issue seems to be specific to the combination of cacheComponents: true, htmlLimitedBots: /.*/, and generateMetadata using runtime data, and may be a bug in Next.js. The provided workaround may not be suitable for all use cases, and further investigation or updates to Next.js may be necessary for a permanent fix.

Recommendation

Apply workaround: Disable cacheComponents or modify generateMetadata to not use runtime data when htmlLimitedBots is enabled, as this is the most straightforward way to resolve the issue without waiting for a potential fix in Next.js.

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 Route "/" did not produce a static shell and Next.js was unable to determine a reason. This is a bug in Next.js. [1 pull requests, 2 comments, 3 participants]