nextjs - ✅(Solved) Fix Prefetch inlining + CC + Catch-all segment causes a build error [1 pull requests, 4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#90893Fetched 2026-04-08 00:19:20
View on GitHub
Comments
4
Participants
3
Timeline
11
Reactions
0
Author
Timeline (top)
commented ×4closed ×1cross-referenced ×1issue_type_added ×1

Error Message

Error: Invariant: missing PAGE segmentPath at ignore-listed frames

Fix Action

Fixed

PR fix notes

PR #90899: Fix prefetch inlining build failure with dynamic routes

Description (problem / solution / changelog)

When prefetchInlining is enabled, the segment data collection returns a special key for the inlined response. Previously this key was /_inlined, but the build validation code in packages/next/src/build/index.ts expects segment paths to contain __PAGE__. This caused builds to fail with "Invariant: missing PAGE segmentPath" for any dynamic route using prefetchInlining.

Fix by using the same PAGE_SEGMENT_KEY (__PAGE__) constant for the inlined segment response key, matching what the build code already expects. This is consistent since the inlined response serves the same role as the per-page segment data — it just bundles all segments together.

Closes #90850

Co-authored-by: Ben Salmon [email protected]

Changed files

  • packages/next/src/client/components/segment-cache/cache.ts (modified, +1/-1)
  • packages/next/src/server/app-render/collect-segment-data.tsx (modified, +2/-1)
  • test/e2e/app-dir/segment-cache/prefetch-inlining/app/dynamic/[slug]/page.tsx (added, +18/-0)
  • test/e2e/app-dir/segment-cache/prefetch-inlining/app/page.tsx (modified, +3/-0)
  • test/e2e/app-dir/segment-cache/prefetch-inlining/prefetch-inlining.test.ts (modified, +11/-3)

Code Example

Error: Invariant: missing __PAGE__ segmentPath
    at ignore-listed frames

---

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:05 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6020
  Available memory (MB): 32768
  Available CPU cores: 12
Binaries:
  Node: 25.8.0
  npm: 11.11.0
  Yarn: 1.22.22
  pnpm: 10.30.3
Relevant Packages:
  next: 16.2.0-canary.79 // Latest available version is detected (16.2.0-canary.79).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/apostolos/next.js-repro/tree/prefetch-inlining-catch-all-segments

To Reproduce

  1. Build the app with pnpm run build
  2. Build fails with the following error:
Error: Invariant: missing __PAGE__ segmentPath
    at ignore-listed frames

Current vs. Expected behavior

Unable to build the app unless prefetchInlining is set to false.

The build should succeed, regardless of the route conventions used.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:05 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6020
  Available memory (MB): 32768
  Available CPU cores: 12
Binaries:
  Node: 25.8.0
  npm: 11.11.0
  Yarn: 1.22.22
  pnpm: 10.30.3
Relevant Packages:
  next: 16.2.0-canary.79 // Latest available version is detected (16.2.0-canary.79).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

No response

extent analysis

Quick Fix

Turn off prefetchInlining for projects that use catch‑all ([...slug]) routes (or upgrade to a Next 16 version where the bug is fixed).

1️⃣ Add / update next.config.js

/** @type {import('next').NextConfig} */
const

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING