File indexing broken for Next.js app directories with dynamic routes (brackets in folder names)
Status Fixed / completed
Maintainer reply ✓ Yes — ddworken
Workaround ✓ Mentioned in thread ↓
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 --versionin 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
- Open a Next.js project with app router structure
- Have directories like
src/app/users/[id]/page.tsxorsrc/app/blog/[slug]/page.tsx - Try to use @ mention to reference any file within
src/apporsrc/components - Notice that NO files from these directories appear in the picker
- Try @ mentioning files from
src/utilsorsrc/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/appandsrc/components(which contain dynamic route folders) are completely missing from @ mention picker - Files in
src/utilsandsrc/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)
6 Comments
Found 3 possible duplicate issues:
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
The original behavior was that using '@' would bring up the directory. Now, please try using '@/' as a temporary workaround.
This worked. Thanks!
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
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!
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.