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

CacheComponents: Client Navigation To GenerateStaticParams Path Crashes With React #412 When Custom CacheHandler Misses

When using Next.js 16.4.0 with cacheComponents and a custom cacheHandler that starts empty (e.g. Redis after eviction), a client-side navigation to a prerendered dynamic route (generateStaticParams) returns an unresumable fallback shell instead of rendering the page, causing React error #412. The issue originates from app-page-runtime.js marking non-prefetch RSC requests as static due to the presence of prefetchDataRoute, and then serving the fallback shell on a cache miss instead of dynamically rendering.

highConfidence 92%Next.jsAffected V16.3.8Affected V16.4.0Affected V16.5.0-Canary.3

Origin Analysis

In app-page-runtime.js, isDynamicRSCRequest is computed as isRoutePPREnabled && isRSCRequest && !isPrefetchRSCRequest && !staticPrefetchDataRoute. For prerendered routes with a prefetchDataRoute, non-prefetch RSC navigation requests are incorrectly considered static. On a cache miss, the condition (nextConfig.cacheComponents ? !isDynamicRSCRequest : !isRSCRequest) evaluates to true, so the fallback shell is served with x-nextjs-postponed: 1. Since static RSC requests are never resumed, the Suspense child row is never sent, causing React error #412.
1. Clone repository from https://github.com/tdejager/next-cache-miss-fallback-shell-repro 2. Run pnpm install && pnpm exec playwright install chromium 3. Execute ./repro.sh (builds and runs next start twice: default cache and CUSTOM_CACHE=1) 4. In custom cache mode, open / and click the /items/a link 5. Observe that the Suspense fallback appears and then the error boundary shows Minified React error #412

Fixing Code Block

Edge Case Audit

This change may cause more requests to be treated as dynamic in cacheComponents mode, potentially increasing server load and altering caching behavior. It should be thoroughly tested with PPR, static export, prefetch, and cache-hit scenarios. Rollback: revert the expression to the original form. Note that this hotfix only addresses the symptom and may not cover all edge cases; monitor for regressions in related navigation flows.

Ecosystem Topology