claude-code - 💡(How to fix) Fix @-mention file picker shows node_modules in pnpm workspaces despite .gitignore exclusion

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The @ file mention picker in Claude Code does not filter out node_modules/ directories in pnpm workspace repos, even though they are excluded by .gitignore.

Root Cause

The @ file mention picker in Claude Code does not filter out node_modules/ directories in pnpm workspace repos, even though they are excluded by .gitignore.

RAW_BUFFERClick to expand / collapse

Summary

The @ file mention picker in Claude Code does not filter out node_modules/ directories in pnpm workspace repos, even though they are excluded by .gitignore.

Steps to Reproduce

  1. Open a pnpm workspace repository (multiple packages under packages/)
  2. Root .gitignore contains node_modules/ (matches all nested node_modules directories per git semantics)
  3. Type @ in the Claude Code prompt to open the file picker
  4. Observe node_modules/ directories appearing in picker results (at root and/or inside packages/)

Expected Behavior

The file picker should apply .gitignore rules the same way git does — node_modules/ in the root .gitignore excludes all nested node_modules/ directories, and none of them should appear in the picker.

Actual Behavior

Nested node_modules/ directories (e.g. packages/foo/node_modules/) appear in the @ file picker even though the root .gitignore contains node_modules/.

Environment

  • OS: macOS (Darwin 25.3.0)
  • Repo structure: pnpm workspace (packages/ with multiple sub-packages, each with their own node_modules/)
  • respectGitignore setting: not set (defaults to true)
  • No project-level settings.json overrides

Notes

The root .gitignore entry node_modules/ is valid git syntax that matches nested directories. git status and git ls-files correctly exclude them. The file picker appears to only check the root-level .gitignore against root-level paths, missing nested matches.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING