Prerequisites
Reproduction url
The affected repo is a private production codebase, so I cannot link it directly — apologies, I know the template asks for one. I'm posting anyway because the measurement is precise and the closed-issue history (#1811, #1897) suggests the mechanism may be recognizable to maintainers without a repro. Happy to build a minimal public reproduction (Next.js App Router + --cache warm run) if this isn't immediately recognizable — say the word and I'll put one up. The knip.ts is short and shareable: entry: ['scripts/**/*.{ts,mjs}'], two ignore globs, ignoreDependencies: ['vercel'], ignoreBinaries: ['cloudflared'], per-rule severities only — no custom plugin config.
Description of the issue
On a warm cache with no config changes, a second knip --cache run loses the Next.js plugin's entry files and reports every app/**/page.tsx (and the files they reach exclusively) as unused. Cold-cache runs are correct and identical to uncached runs, so this is not the usual stale-after-config-change case.
Setup: Next.js 16 App Router repo, pnpm 10.4.1, TypeScript 5.9.3, Node LTS, macOS arm64, knip 6.32.2, config in knip.ts (Next.js, Vitest multi-project, Drizzle, Sentry, ESLint, Playwright, GitHub Actions, pnpm plugins all auto-detected; zero configuration hints on the uncached run).
Measured 2026-08-24:
| Run |
Result |
| no cache |
92 unused files, 5 unused deps, 0 hints |
--cache, cold (cache dir just cleared) |
92 / 5 / 0 — identical |
--cache, warm, config unchanged |
401 unused files / 12 deps / 3 devDeps + hint "Add entry" — every app/**/page.tsx reported unused |
The warm-run tell is unmistakable: the unused-files count jumps by exactly the set of route files plus their exclusive reach, and knip emits an "Add entry" configuration hint that the uncached run does not. Deleting node_modules/.cache/knip restores correct results for exactly one run.
Expected: a warm cached run with unchanged configuration reports the same issues as an uncached run.
Possibly related (both closed):
Both are warm-cache entry-file defects; 6.32.2 appears to still carry a variant where plugin-provided entries (Next.js routes) are not re-resolved on a warm cache even when nothing changed.
Prerequisites
--cache: warm run crashes (RangeError: Invalid array length) — config files re-stored during Map iteration on cached path #1811, 🐛 --cache misses new entry files in previously unmatched directories #1897 — both closed, see below)Reproduction url
The affected repo is a private production codebase, so I cannot link it directly — apologies, I know the template asks for one. I'm posting anyway because the measurement is precise and the closed-issue history (#1811, #1897) suggests the mechanism may be recognizable to maintainers without a repro. Happy to build a minimal public reproduction (Next.js App Router +
--cachewarm run) if this isn't immediately recognizable — say the word and I'll put one up. Theknip.tsis short and shareable:entry: ['scripts/**/*.{ts,mjs}'], twoignoreglobs,ignoreDependencies: ['vercel'],ignoreBinaries: ['cloudflared'], per-rule severities only — no custom plugin config.Description of the issue
On a warm cache with no config changes, a second
knip --cacherun loses the Next.js plugin's entry files and reports everyapp/**/page.tsx(and the files they reach exclusively) as unused. Cold-cache runs are correct and identical to uncached runs, so this is not the usual stale-after-config-change case.Setup: Next.js 16 App Router repo, pnpm 10.4.1, TypeScript 5.9.3, Node LTS, macOS arm64, knip 6.32.2, config in
knip.ts(Next.js, Vitest multi-project, Drizzle, Sentry, ESLint, Playwright, GitHub Actions, pnpm plugins all auto-detected; zero configuration hints on the uncached run).Measured 2026-08-24:
--cache, cold (cache dir just cleared)--cache, warm, config unchangedapp/**/page.tsxreported unusedThe warm-run tell is unmistakable: the unused-files count jumps by exactly the set of route files plus their exclusive reach, and knip emits an "Add entry" configuration hint that the uncached run does not. Deleting
node_modules/.cache/kniprestores correct results for exactly one run.Expected: a warm cached run with unchanged configuration reports the same issues as an uncached run.
Possibly related (both closed):
--cache: warm run crashes (RangeError: Invalid array length) — config files re-stored during Map iteration on cached path #1811 — warm-cache run crashes (closed 2026-06)Both are warm-cache entry-file defects; 6.32.2 appears to still carry a variant where plugin-provided entries (Next.js routes) are not re-resolved on a warm cache even when nothing changed.