Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Next.js cache is poisoned when notFound() is triggered. | GoodFirstPicks

Next.js cache is poisoned when notFound() is triggered.

vercel/next.js 12 comments 17d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeTest focusedNext.jsTypeScriptReact

Why this is a good first issue

Cache poisoning issue during rapid test execution requires careful investigation of Next.js caching behavior.

AI Summary

The issue describes a cache poisoning problem where 404 responses bleed into valid page requests during rapid test execution. This requires understanding Next.js caching mechanisms and testing infrastructure, but has clear reproduction steps. The main challenge is diagnosing the root cause of the cache contamination.

Issue Description

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/bold-breeze-8dykdw

To Reproduce

The link of the reproduction codesandbox does not actually trigger the bug. But shows the situation.

This is the scenario / bug:

  1. I have three playwright e2e tests: a. Go to pokemon detail of bulbasaur b. Go to detail of nonexisting pokemon to test 404 this triggers the notFound() c. create pokemon via form client component which calls a server function that calls updateTags

  2. Playwright runs the tests in chrome, firefox and safari

  3. The second browser firefox fails the first test "Go to pokemon detail of bulbasaur" because it gets shown the 404 not-found.tsx page.

  4. I go to /pokemon/1 manually and I can also sometimes get the 404 error.

I can only reproduce this locally with playwright, when it is running tests very rapidly.

What seems to happen is that there is a timing issue, somehow a 404 cache is assigned to a page that did not trigger the notFound(). I call this the poisoning of the cache. In other words /pokemon/1 seems to render the 404 result of /pokemon/1337.

Current vs. Expected behavior

I expect that notFound 404 pages are cached properly, and that they do not bleed over to pages that result in a 200.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:54:55 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6031
  Available memory (MB): 36864
  Available CPU cores: 14
Binaries:
  Node: 24.12.0
  npm: 11.6.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.2.0-canary.95 // Latest available version is detected (16.2.0-canary.95).
  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)

cacheComponents, Use Cache, Not Found

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

next start (loca

GitHub Labels

Cache ComponentsNot Found

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • cache poisoning
  • race condition
  • cross-browser testing
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedyes
Assigneeunstubbable