AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Router State Header Parse Failure On Soft Navigation After Upgrade To V16.2 With Dynamic Rendering

When a client that has loaded a page from Next.js 16.1 performs a soft navigation (Link click) after the server is upgraded to 16.2, the old-format router state header sent by the client cannot be parsed by the new server, causing a 500 error. The issue only occurs when dynamic rendering is involved (e.g., using cookies()) because such requests always hit the server for RSC payload validation.

highConfidence 72%Next.jsAffected V16.2.0Affected V16.2.1-Canary.45

Origin Analysis

The encoding or serialization format of the `x-nextjs-router-state-tree` header changed between Next.js 16.1 and 16.2. The server-side parser in 16.2 attempts to parse the header using the new format and throws `The router state header was sent but could not be parsed` when it receives a stale 16.1 header. The parser lacks a fallback for older clients, so a soft navigation during a deployment window triggers a server error instead of degrading gracefully.
1. Clone https://github.com/abdonrd/nextjs-header-could-not-be-parsed 2. Install dependencies with Next.js 16.1.x, run `npm run build && npm start` 3. Open http://localhost:3000 in a browser 4. Upgrade to Next.js 16.2.x (`npm install next@canary`), rebuild, and restart the server 5. Without refreshing the browser, click the 'About' navigation link 6. Observe the 500 error: 'The router state header was sent but could not be parsed.'

Fixing Code Block

Edge Case Audit

This fix degrades soft navigation to a full page reload for clients with a stale router state header, which may lose client-side UI state and cause a visible page refresh. It masks any underlying corruption in the header rather than fixing the format mismatch. Backward-compatible parsing should be implemented for true soft navigation support. Rollback: if this patch causes unexpected full reloads, revert to a server version matching the client's header format or force clients to reload once via a version bump.

Ecosystem Topology