nextjs - ✅(Solved) Fix Next.js 16: Mismatch in RSC file paths causes 404 errors in static exports [1 pull requests, 15 comments, 9 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#85374Fetched 2026-04-08 02:16:06
View on GitHub
Comments
15
Participants
9
Timeline
45
Reactions
11
Author
Timeline (top)
subscribed ×17commented ×15mentioned ×6labeled ×2

Error Message

When visiting static exported page has next/link with default prefetching or is explicitly set to true / "auto" / null, the page attempts to fetch the target page's RSC Payload from incorrect path, resulting in a 404 Not Found error (e.g., '.../page/__next.page.PAGE.txt?_rsc=...').

Fix Action

Fix / Workaround

Workaround

To fix this, you can use a build adapter, which is explained in Axiorema's blog: The Workaround: A Build Adapter.

PR fix notes

PR #86948: Fix 'output:export' incorrect file copy in Windows build environment

Description (problem / solution / changelog)

Fix #85374 (Maybe...)

Go easy on me. that's because, This is my first PullRequest. (and English beginner 😢 )

Problem

output:export copy function, use only slash (/) as path characters. But, Windows Environment use backslash(\). so This files is incorrectly copied, and Different 'out' directory content other platform(Linux/macOS).

Linux(WSL)WindowsWindows (Fixed)
<img width="500" src="https://github.com/user-attachments/assets/31ffac19-d728-4217-89d3-79b642201a19" /><img width="500" src="https://github.com/user-attachments/assets/31c20e00-0a1e-4493-aee4-df93c006e0bd" /><img width="500" src="https://github.com/user-attachments/assets/f3a95d97-6ed0-4e3d-a85e-3f22db20eb1f" />

Also, Always fail (404) for next/link Prefetch in this problem for Windows Build Environment.

<img width="300" src="https://github.com/user-attachments/assets/6fdffc45-d80b-4bb9-bc12-6bff8321b70c" />

Solution

This PullRequest is replace '/' to path.sep in output:export dist copy function. (Node.js Path module)

Thank you.

Changed files

  • packages/next/src/export/index.ts (modified, +1/-1)
  • packages/next/src/shared/lib/segment-cache/segment-value-encoding.ts (modified, +3/-1)

Code Example

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Home
  Available memory (MB): 32578
  Available CPU cores: 16
Binaries:
  Node: 20.19.5
  npm: 10.8.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.0.1
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: export
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/Aaakul/next16-next-link-rsc-issue

To Reproduce

  1. Clone the reproduction repository
  2. Run cd next16
  3. Run npm install
  4. Run npm run build (output: 'export' is already set in next.config.ts)
  5. Run npx serve out
  6. Visit /next16 in a browser (e.g., http://localhost:3000/next16), open developer tools and check the console for 404 errors. Click the link to navigate to /next16/page, refresh and check if similar errors appears.
  7. Run cd ..
  8. Run cd next15
  9. Repeat 3~6

Current vs. Expected behavior

Current Behavior (Next.js 16.0.0 ~ 16.1.1 + output: 'export'):

When visiting static exported page has next/link with default prefetching or is explicitly set to true / "auto" / null, the page attempts to fetch the target page's RSC Payload from incorrect path, resulting in a 404 Not Found error (e.g., '.../page/__next.page.PAGE.txt?_rsc=...'). <img width="910" height="31" alt="Image" src="https://github.com/user-attachments/assets/5e524242-0e1e-4f99-af56-28135e926fc1" />

Expected Behavior (Next.js 15.5.6 + output: 'export'):

Invalid RSC requests are not expected in statically exported pages

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Home
  Available memory (MB): 32578
  Available CPU cores: 16
Binaries:
  Node: 20.19.5
  npm: 10.8.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.0.1
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: export

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

Linking and Navigating, Output

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

next build (local), Other (Deployed)

Additional context

According to Axiorema's blog and this Next.js pull request, the problem comes from a big change in Next.js 16. This change affects how React Server Component (RSC) data is loaded. Even if you don’t use the new "Cache Components" feature, it still changes the way RSC data is handled.

The main issue is a mismatch between the file paths created during the build process and the file paths the browser looks for:

  • During the build, the file might be saved in a folder like __next/page/__PAGE__.txt.
  • But the browser tries to find the file with a name like __next.page.__PAGE__.txt.

Workaround

To fix this, you can use a build adapter, which is explained in Axiorema's blog: The Workaround: A Build Adapter.

extent analysis

TL;DR

The most likely fix for the issue is to use a build adapter to correct the mismatch between the file paths created during the build process and the file paths the browser looks for.

Guidance

  • The issue is caused by a change in Next.js 16 that affects how React Server Component (RSC) data is loaded, resulting in a mismatch between the file paths created during the build process and the file paths the browser looks for.
  • To verify the issue, check the console for 404 errors when visiting a static exported page with next/link and default prefetching or explicitly set to true / "auto" / null.
  • The workaround involves using a build adapter, as explained in Axiorema's blog, to correct the file path mismatch.
  • The build adapter will ensure that the file paths created during the build process match the file paths the browser looks for, resolving the 404 errors.

Example

No code snippet is provided as the issue is related to the build process and file path handling, and the workaround involves using a build adapter.

Notes

The issue is specific to Next.js 16.0.0 ~ 16.1.1 and does not exist in Next.js 15. The workaround is a temporary solution until the issue is resolved in a future version of Next.js.

Recommendation

Apply the workaround by using a build adapter, as explained in Axiorema's blog, to correct the file path mismatch and resolve the 404 errors. This is a temporary solution until the issue is resolved in a future version of 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 Next.js 16: Mismatch in RSC file paths causes 404 errors in static exports [1 pull requests, 15 comments, 9 participants]