Skip to content

🐛 --cache warm run loses Next.js plugin entry files: every app/**/page.tsx reported as unused (6.32.2) #1965

Description

@digitalcostas

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.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions