File indexing broken for Next.js app directories with dynamic routes (brackets in folder names)

Status Fixed / completed
Maintainer reply ✓ Yes — ddworken
Activity 6 comments · opened Aug 6, 2025 · closed Dec 5, 2025
💡 Likely answer: A maintainer (ddworken, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other:
  • Claude CLI version: <!-- run claude --version in terminal -->
  • Operating System: macOS 14.6 (Darwin 23.6.0)
  • Terminal: Terminal App

Bug Description

The @ mention file picker completely fails to index any files within directories that contain Next.js dynamic route folders (folders with brackets like [id], [username]). This was working perfectly an hour ago but broke after creating a new Claude Code instance. The issue only affects directories containing bracketed subdirectories - other directories work fine.

Steps to Reproduce

  1. Open a Next.js project with app router structure
  2. Have directories like src/app/users/[id]/page.tsx or src/app/blog/[slug]/page.tsx
  3. Try to use @ mention to reference any file within src/app or src/components
  4. Notice that NO files from these directories appear in the picker
  5. Try @ mentioning files from src/utils or src/services (no bracketed subdirs) - these work fine

Expected Behavior

All files in the project should be indexed and available via @ mention, including those in directories containing Next.js dynamic routes with brackets.

Actual Behavior

  • Files in src/app and src/components (which contain dynamic route folders) are completely missing from @ mention picker
  • Files in src/utils and src/services (no dynamic routes) work perfectly
  • This is a regression - it worked in the previous Claude Code instance from an hour ago

Additional Context

  • Project structure uses Next.js 15 with app router
  • Running find src/app -name "*.tsx" shows 50+ files that should be indexed but aren't
  • Cleared all caches with rm -rf ~/.cache/claude* - didn't help
  • The pattern is clear: any directory tree containing folders with brackets [param] fails to index
  • 557 total files in project (excluding node_modules, .next, etc)
  • File watcher limits are fine (kern.maxfilesperproc: 2200000)

View original on GitHub ↗

6 Comments

github-actions[bot] · 1 year ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5198
  2. https://github.com/anthropics/claude-code/issues/1791
  3. https://github.com/anthropics/claude-code/issues/1748

If your issue is a duplicate, please close it and 👍 the existing issue instead.

<sub>This issue will be automatically closed as a duplicate in 3 days if there are no additional comments. To prevent auto-closure, please 👎 this comment.</sub>

🤖 Generated with Claude Code

ito27 · 1 year ago

The original behavior was that using '@' would bring up the directory. Now, please try using '@/' as a temporary workaround.

mtaksa · 1 year ago
The original behavior was that using '@' would bring up the directory. Now, please try using '@/' as a temporary workaround.

This worked. Thanks!

sean-adams · 9 months ago

This issue is still occurring for me. It also occurs in the "Current file selection" functionality, preventing Claude from detecting any file nested within a subdirectory containing square brackets, or if the filename contains square brackets itself

ddworken collaborator · 8 months ago

Hi! I just wanted to note that this has now been fixed. If you experience any other issues similar to this, please open a new issue!

github-actions[bot] · 8 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.