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

PPR Pages Lose Cache After `Next Start` Restart And RSC Payload Serves Stale Build-Time Data Due To Missing `.Rsc` File In File-System-Cache

File-system-cache `set()` omits the `.rsc` file for PPR routes, causing `get()` to treat the entry as missing after restart or eviction. This results in fallback shell re-rendering and stale RSC payloads for client navigation, leading to data inconsistency.

highConfidence 90%Next.jsApp RouterRoute HandlersAffected V16.4.0-Canary.63Affected V16.3.5Affected V16.3.8

Origin Analysis

In Next.js file-system-cache, the `set` method writes the `.rsc` file only under conditions that do not cover PPR routes upgraded from the fallback shell to a static page. When `postponed` becomes `null` at runtime, `value.rsc` is available but is skipped, so the `.rsc` is never persisted. On restart or eviction, `get()` finds `.html` but no `.rsc` and, because `postponed == null`, falls back to the shell or build-time data, causing the observed mismatch.
1. Clone repro repo. 2. Run `npm install`. 3. Run `./repro.sh` for restart scenario, or `PROBE_MEM=40000 ./repro.sh evict` for eviction scenario. 4. Observe fallback shell after restart/eviction and stale RSC payload on client navigation.

Fixing Code Block

Edge Case Audit

The added `.rsc` write increases disk I/O for every PPR cache set. The unlink operation may race with concurrent cache writes or eviction if multiple processes share the same cache directory (e.g., multiple Next.js instances on the same host). Ensure no simultaneous access to the same cache path or use a single-writer design. Rollback: revert this patch and clear the cache directory to avoid inconsistent state, but the original bug will recur.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state