Skip to content

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

Description

@krzkz94

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.

Activity

  1. added theissue type on Sep 16, 2026
  2. Tiancheng-Xu commented on Sep 16, 2026

    @Tiancheng-Xu

    I can investigate this cache miss path. I will reproduce the failure with the provided fixture, trace the fallback-shell handling for generated dynamic routes, and add a focused regression test with the smallest fix if the behavior is confirmed. I will report the exact validation in the PR.

  3. Tiancheng-Xu commented on Sep 16, 2026

    @Tiancheng-Xu

    I reproduced this with the linked fixture on Next 16.4.0-canary.33: the production build succeeds, but fresh /en and /fr requests return HTTP 500 with the custom cache and partial prefetching enabled; the filesystem-cache and prefetch-off controls return 200. I am continuing from this confirmed failure.

  4. hemnath-hub commented on Sep 23, 2026

    @hemnath-hub

    /assign

  5. added 2 commits that reference this issue on Sep 24, 2026
    3b45723
    8979477
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dynamic RoutesRelated to dynamic routes.RuntimeRelated to Node.js or Edge Runtime with Next.js.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions