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

Turbopack Dev Regression: Pages Router Page Modules Missing After _App Availability Seeding (#97664)

In Next.js 16.4.0 dev with Turbopack, Pages Router pages crash during hydration because required client modules are not included in any chunk. The regression was introduced by #97664, which seeded availability info from the _app chunk group into page chunk groups; in dev each entry has its own module graph, so availability items from _app are wrongly treated as already available, causing modules like a-page-only and b-boundary to be skipped.

highConfidence 95%Next.jsAffected V16.4.0-Canary.0Affected V16.4.0Affected V16.5.0-Canary.2

Origin Analysis

#97664 makes every non-_app page's client chunk group start from the availability_info of the /_app chunk group. In next dev, each entry has its own module graph; the availability items from the _app graph refer to nodes that are not the same in the page graph. Specifically, a page entry pre-batch [a, Ref(b), c, Ref(d), e, index] splits into module batches where Module(c) holds references to earlier siblings a and b. The _app graph has Module(c) as an available item; when chunk_group_content processes the page graph, it marks Module(c) as available and returns Exclude, skipping its subtree, so a and b are never assigned to any chunk, leading to module factory not available during hydration.
1. Clone https://github.com/Stanzilla/next-turbopack-app-availability-repro 2. npm install 3. npm run dev (next dev --turbopack -p 3456) 4. Open http://localhost:3456/ 5. Observe hydration error: Module [project]/lib/a-page-only.js was instantiated but the module factory is not available.

Fixing Code Block

Edge Case Audit

This change only affects dev and restores pre-16.4.0 behavior. No production impact. If applied, ensure to remove/disable any dev-specific caching of availability info and test with the provided repro and large Pages Router apps. Rollback: revert to the original code that unconditionally uses app_availability; however that reintroduces the dev bug. For a more robust fix, consider making availability info graph-scoped or excluding only cross-graph references in chunk_group_content.

Ecosystem Topology