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

Build Instant Validation Misses Staged Fallback Params

Next.js build-time Instant Validation for Cache Components does not populate staged fallback params in the synthetic RequestStore, causing false negatives for invalid param access outside Suspense boundaries in dynamic routes with PPR.

highConfidence 78%Next.jsAffected V16.4.0-Canary.37

Origin Analysis

The synthetic RequestStore created during build-time Instant Validation omits the `stagedFallbackParams` property from the prerender shell selected by the sample pathname. This causes sampled params that should remain staged to resolve as static values, so the build misses the required Suspense boundary validation error.
1. Use Cache Components with a dynamic route that has a prerendered fallback shell. 2. Configure `instant.unstable_samples` with a concrete value for a route param that is still staged by the selected shell. 3. Read that param outside a Suspense boundary. 4. Run `next build`. Expected: build validation fails with missing Suspense around params error. Actual: build succeeds because stagedFallbackParams is absent in the synthetic RequestStore.

Fixing Code Block

Edge Case Audit

Ensure the selected shell lookup uses the same route normalization and filtering as development, including route groups, optional parameters, and fallback behavior. A mismatched manifest version or stale cache could cause incorrect params. This change only mutates the synthetic store used for validation; it does not affect runtime. Rollback can be done by removing the added assignment.

Ecosystem Topology