[BUG] ripgrep tool in FreeBSD constant failure for internal `Search`

Resolved 💬 7 comments Opened Dec 5, 2025 by lnxprof Closed Feb 28, 2026

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

  1. Create or identify a file with known content (e.g., /home/claudeuser/feature/WORKFLOW.md)
  2. Use Claude Code Grep tool to search for a known pattern:

``
Grep pattern="Request" path="/home/claudeuser/feature/WORKFLOW.md"
``

  1. Observe: Returns "No matches found"
  2. Verify with bash grep:

``
grep -n "Request" /home/claudeuser/feature/WORKFLOW.md
``

  1. 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

  1. Productivity Loss: Developers must remember to use bash workarounds instead of native tools
  2. Context Overhead: Using bash commands increases token usage in conversations
  3. Inconsistent Experience: Mixed tool reliability creates confusion
  4. 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:

  1. The ripgrep binary or library interaction on FreeBSD
  2. Possible permission or file access differences between FreeBSD and Linux
  3. 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

  1. Test ripgrep binary directly on FreeBSD to isolate if it's a binary issue
  2. Check file reading permissions and methods used by the Grep tool
  3. Verify character encoding handling between the tool and FreeBSD file systems
  4. Consider implementing a fallback to system grep when ripgrep fails
  5. 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

View original on GitHub ↗

This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗