[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:
``bash``
# 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
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗