vercel / vercel/next.js

Navigation crashes with React #412 on partial RSC payloads

Open
#97,337 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/yultyyev/next-partial-nav-repro

To Reproduce
  1. Run prod server:
    npm install
    npm run build
    npm start (starts Next on :3001 and the cache proxy on :3000)
    npm run seed (stores one prefetch response in the cache)

  2. Open http://localhost:3000 and click "go to /target".
    You get the error screen ("This page couldn't load. Reload to try again, or go back.") and this in the console:
    Uncaught Error: Minified React error # 412 ("Connection closed.")
    Open http://localhost:3000/target directly in a new tab: it renders fine.

p.s. Production mode is required: the payload demonstrated (a partial prefetch of a PPR page, first byte '~') only exists for a built app. next dev does not prerender, so it has nothing to mis-serve.

Current vs. Expected behavior

Current: clicking the link shows the error screen ("This page couldn't load") with an uncaught "Minified React error #412" ("Connection closed."). Opening the same URL directly works.

Details: the fetch succeeds and the navigation commits, because the payload's root row resolves. The rows still pending when the stream ends are rejected with #412 later, during React render. That happens outside the try/catch in fetchServerResponse, so the existing "Failed to fetch RSC payload ... Falling back to browser navigation" recovery never runs (verified: that log line never appears).

Expected: fall back to a full page load, like the other failure modes in the same path:

  • fetch rejects -> browser navigation fallback
  • deployment id / build mismatch -> fallback
  • response is not text/x-component -> fallback
  • flight stream ends with rows pending -> currently an uncaught crash

I'm not asking for allowPartialStream on navigations: rendering an incomplete page as if complete would be worse, and #96426 already (correctly) chose to prevent truncated streams on the server side. The ask is only: when consuming the navigation payload fails, do a full page load instead of crashing.

Reader context: the segment cache reader (segment-cache/cache.ts) passes allowPartialStream: true, which is correct since prefetch payloads are partial by design. The navigation reader has no such option and no handling for this failure. In 16.3.0 the one branch that could pass the flag is marked legacy-PPR-only; on canary it is removed (res.flightResponsePromise!).

Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.5.0
Binaries:
  Node: 24.15.0
  npm: 11.12.1
Relevant Packages:
  next: 16.3.0 // Latest available version is detected (16.3.0).
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 7.0.2
Next.js Config:
  cacheComponents: true

Also reproduces on canary (tested on 16.3.1-canary.15).
Which area(s) are affected? (Select all that apply)

Partial Prerendering (PPR)

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

next start (local)

Additional context

About the caching proxy: it is not a realistic CDN, and I'm not claiming it is. It ignores Cache-Control (the RSC response says no-store), ignores the ?_rsc cache-buster (keys on pathname only), and ignores Vary. Its only job is to reproducibly hand the router a payload Next itself generated. The repro is about what the client does when such a payload arrives.

Why that matters: we also saw a self-hosted production app on 16.3.0 return partial payloads to normal navigations straight from the origin, with no cache in front at all (first byte '~', x-nextjs-postponed: 1, no x-nextjs-cache header). Every click showed the error screen for hours while direct page loads kept working. Server-side production of truncated flight streams was also the bug class in #96339.

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

Start with the linked reproduction by running its production build, seed, and navigation steps, then trace the navigation path around fetchServerResponse and the segment-cache reader in segment-cache/cache.ts. Confirm that a partial RSC payload with pending rows triggers the existing full browser-navigation fallback instead of an uncaught React #412 error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, react
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.