[BUG] ripgrep tool in FreeBSD constant failure for internal `Search`
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Executive Summary
The Claude Code built-in Grep tool consistently fails on FreeBSD systems, returning zero results even when matches exist. This forces users to rely on bash grep commands as a workaround, reducing efficiency and requiring manual intervention.
Bug Description
The Grep tool, which is built on ripgrep, consistently returns "No matches found" or "Found 0 lines" on FreeBSD systems, even when the search pattern exists in the target files. The Glob tool functions correctly in the same environment, indicating this is specific to the Grep tool implementation.
What Should Happen?
Expected Behavior
The Grep tool should find and return all matching lines, similar to the bash grep command output.
Error Messages/Logs
Steps to Reproduce
Reproduction Steps
Test Case 1: Simple Pattern Search
- Create or identify a file with known content (e.g., /home/claudeuser/feature/WORKFLOW.md)
- Use Claude Code Grep tool to search for a known pattern:
Grep pattern="Request" path="/home/claudeuser/feature/WORKFLOW.md" - Observe: Returns "No matches found"
- Verify with bash grep:
grep -n "Request" /home/claudeuser/feature/WORKFLOW.md - Observe: Correctly finds 4 occurrences on lines 18, 43, 84, 96
Test Case 2: Code Search Example
- Date First Observed: 2025-09-29
- Search Pattern: "adjustFeedCosts" in PHP files
- Grep Tool Result: Found 0 lines
- Bash grep Result: Multiple matches found in Markup.php
Actual Behavior
The Grep tool consistently returns zero results regardless of:
- Pattern complexity (simple strings or regex)
- File type (markdown, PHP, text files)
- Output mode (content, files_with_matches, count)
- Search scope (single file or directory)
Impact
- Productivity Loss: Developers must remember to use bash workarounds instead of native tools
- Context Overhead: Using bash commands increases token usage in conversations
- Inconsistent Experience: Mixed tool reliability creates confusion
- Documentation Burden: Users must maintain separate notes about tool failures
Workaround
Users must use bash grep commands exclusively for content searching:
# Instead of Grep tool, use:
grep -n "pattern" /path/to/file
grep -r "pattern" /path/to/directory --include="*.php"
find /path -name "*.php" -exec grep -l "search_term" {} \;
Additional Evidence
Comparison Test Performed 2025-12-05
Glob Tool (WORKS):
- Command:
Glob pattern="*.md" path="/home/claudeuser/feature" - Result: Successfully found README.md and WORKFLOW.md
Grep Tool (FAILS):
- Command:
Grep pattern="Request" path="/home/claudeuser/feature/WORKFLOW.md" - Result: "No matches found"
Bash grep (WORKS):
- Command:
grep -n "Request" /home/claudeuser/feature/WORKFLOW.md - Result: Found 4 matches on lines 18, 43, 84, 96
Claude Model
None
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
1.0.04
Platform
Anthropic API
Operating System
Other
Terminal/Shell
Xterm
Additional Information
Technical Analysis
The issue appears to be specific to:
- The ripgrep binary or library interaction on FreeBSD
- Possible permission or file access differences between FreeBSD and Linux
- Potential character encoding or file reading implementation issues
The fact that Glob works but Grep fails suggests the issue is in the content reading/searching mechanism rather than file system access.
Suggested Fixes
- Test ripgrep binary directly on FreeBSD to isolate if it's a binary issue
- Check file reading permissions and methods used by the Grep tool
- Verify character encoding handling between the tool and FreeBSD file systems
- Consider implementing a fallback to system grep when ripgrep fails
- Add FreeBSD-specific testing to the Claude Code test suite
Environment Details
- Operating System: FreeBSD 14.3-RELEASE-p5
- Claude Code Version: Current as of 2025-12-05
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/10673
- https://github.com/anthropics/claude-code/issues/7344
- https://github.com/anthropics/claude-code/issues/9462
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
Found 3 possible duplicate issues:
- [BUG] FreeBSD not supported - bash commands hang indefinitely (v2.0.29) #10673
- File Search Returns No Results Despite Matching Content #7344
- [BUG] Bundled ripgrep fails on Raspberry Pi 5 due to jemalloc page size mismatch #9462
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
The first bug is not related as it is bash command hanging, this is relating to internal Search for claude. The second bug relates to Windows, and this specific issue is narrowed down to ripgrep on FreeBSD The third bug is also a Linux environment, not experiencing the issue here.
Related https://github.com/anthropics/claude-code/issues/4741
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Also experiencing this on FreeBSD 14.3. Using a SessionStart hook to symlink system ripgrep as a workaround. +1 for falling back to system rg when platform binary is missing.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
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.