vercel / vercel/next.js

Partial Prefetching: generated routes return HTTP 500 on a cold custom-cache miss

Open
#98,732 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dynamic Routes Runtime
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/krzkz94/nextjs-partial-prefetch-cache-miss-repro

To Reproduce
  1. Clone the reproduction and install its pinned dependencies:
git clone https://github.com/krzkz94/nextjs-partial-prefetch-cache-miss-repro.git
cd nextjs-partial-prefetch-cache-miss-repro
npm ci
npm test
  1. The script builds the app successfully, starts a fresh production server, and requests /en and /fr. Both paths are returned by generateStaticParams().

  2. Observe HTTP 500 for both generated routes. The test exits with status 1 because it expects HTTP 200.

Build logs, server logs, and JSON results are saved under artifacts/<next-version>/<mode>-<bundler>/.

To reproduce with Turbopack:

npm run test:turbopack

Run these controls sequentially:

npm run test:filesystem
npm run test:prefetch-off

Both controls return HTTP 200.

Current vs. Expected behavior

Current:

The production build succeeds and generates /en and /fr, but the first requests to those routes return HTTP 500 when all of the following are configured:

  • cacheComponents: true
  • partialPrefetching: true
  • A custom incremental cache handler that initially returns null
  • cacheMaxMemorySize: 0

The server trace shows the concrete route missing, followed by a generic fallback-shell miss:

[cache.get] {"key":"/en","kind":"APP_PAGE","isFallback":false,"hit":false}
[cache.get] {"key":"/[locale]","kind":"APP_PAGE","isFallback":true,"hit":false}
Error: Route "/[locale]": Next.js encountered uncached or runtime data during prerendering.
code: 'NEXT_STATIC_GEN_BAILOUT'

Expected:

/en should return HTTP 200 with Locale: en, and /fr should return HTTP 200 with Locale: fr. A cache miss should allow these generated routes to render successfully.

The page only awaits params and renders the locale. It performs no data fetching.

Provide environment information
Operating System:
    Platform: darwin
    Arch: arm64
    Version: Darwin Kernel Version 27.0.0: Tue Aug 11 21:05:48 PDT 2026; root:xnu-13432.1.9~1/RELEASE_ARM64_T6041
    Available memory (MB): 65536
    Available CPU cores: 16
  Binaries:
    Node: 24.11.1
    npm: 11.6.2
    Yarn: N/A
    pnpm: 8.15.9
  Relevant Packages:
    next: 16.4.0-canary.33
    eslint-config-next: N/A
    react: 19.2.0
    react-dom: 19.2.0
    typescript: N/A
  Next.js Config:
    output: N/A
Which area(s) are affected? (Select all that apply)

cacheComponents, Dynamic Routes, Partial Prerendering (PPR), Runtime

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

next start (local)

Additional context

Verified results:

  • Next.js 16.3.5 with webpack: build succeeds; both generated routes return 500.
  • Next.js 16.4.0-canary.33 with webpack and Turbopack: build succeeds; both generated routes return 500.
  • Using Next's default filesystem cache, while retaining partial prefetching and cacheMaxMemorySize: 0: both routes return 200.
  • Keeping the custom cache but disabling partial prefetching: both routes return 200.

The reproduction uses only Next.js, React, and React DOM. The custom cache is a small in-memory Map. There is no Redis, external service, third-party cache library, authentication, or dependency patch.

The trace suggests investigating the handling of the generic /[locale] fallback shell during runtime regeneration versus build-time shell validation. The repository demonstrates the behavior without bundling or prescribing a particular fix.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked reproduction, run npm ci and npm test, then compare the failing partial-prefetching run with npm run test:filesystem and npm run test:prefetch-off. Start from the cache.get trace for /en and /[locale] and the runtime handling of the generic fallback shell; done means generated /en and /fr requests return HTTP 200 with their locale responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, react
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.