nextjs - 💡(How to fix) Fix app/favicon.ico scaffold conflicts with unstable_instant validation; error message doesn't name the file [1 comments, 2 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#91786Fetched 2026-04-08 01:12:01
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
closed ×1commented ×1labeled ×1locked ×1

Error Message

``` Route "/": Runtime data such as cookies(), headers(), params, or searchParams was accessed inside generateMetadata or you have file-based metadata such as icons that depend on dynamic params segments. ```

No filename. No suggested fix.

Fix Action

Workaround

Removing app/favicon.ico and moving the reference to metadata.icons in the layout resolves the build error. The filename isn't surfaced in the error — found by process of elimination.

RAW_BUFFERClick to expand / collapse

What happened

A fresh create-next-app 16.2.1 app with cacheComponents: true and unstable_instant on any route fails to build out of the box.

create-next-app scaffolds app/favicon.ico by default. This file is treated as file-based metadata and conflicts with unstable_instant build-time validation. The error message is generic and gives no indication of what caused it.

Error

``` Route "/": Runtime data such as cookies(), headers(), params, or searchParams was accessed inside generateMetadata or you have file-based metadata such as icons that depend on dynamic params segments. ```

No filename. No suggested fix.

Steps to reproduce

```bash npx create-next-app@latest my-app --typescript --app ```

Add to next.config.ts: ```ts cacheComponents: true ```

Add to app/page.tsx: ```ts export const unstable_instant = { prefetch: 'static' } ```

Run next build → build fails.

Workaround

Removing app/favicon.ico and moving the reference to metadata.icons in the layout resolves the build error. The filename isn't surfaced in the error — found by process of elimination.

Reproduction

https://github.com/aurorascharff/instant-favicon-repro

extent analysis

Fix Plan

To resolve the build error, follow these steps:

  • Remove the default app/favicon.ico file.
  • Update the app/layout.tsx file to reference the favicon using the metadata.icons property.

Example code changes:

// Remove the favicon.ico file from the app directory

// Update app/layout.tsx
import { Html, Head, Main, NextScript } from 'next/document';

export default function Document() {
  return (
    <Html>
      <Head>
        <link rel="icon" href="/favicon.ico" /> // Update this line
      </Head>
      <body>
        <Main />
        <NextScript />
      </body>
    </Html>
  );
}

Alternatively, you can also remove the favicon reference altogether if it's not needed.

Verification

After making these changes, run next build to verify that the build error is resolved. The app should build successfully with cacheComponents: true and unstable_instant enabled.

Extra Tips

  • Be aware of file-based metadata that may conflict with unstable_instant build-time validation.
  • When encountering generic error messages, try removing or updating file-based metadata to resolve the issue.
  • Refer to the Next.js documentation for more information on unstable_instant and cacheComponents.

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