Search tool doesn't find anything when user has custom `~/.config/ripgrep/.ripgreprc` present

Status Fixed / completed
Maintainer reply ✓ Yes — ant-kurt
Activity 11 comments · opened Sep 4, 2025 · closed Oct 27, 2025
💡 Likely answer: A maintainer (ant-kurt, collaborator) responded on this thread — see the highlighted reply below.

Search tool doesn't find anything when user has custom ~/.config/.ripgreprc present.

I'm also experiencing this issue - the below report was closed as stale. So here is me reopening it.

Ok I figured it out! Like a few different variations of issues have mentioned, the issue is with ripgrep! The issue specifically is having a ripgrep config file (~/.config/.ripgreprc) set on my system. I am on Windows using Claude Code through WSL2 (arch) and using zsh (if any of that matters). The solution for me was to add to the Claude Code settings.json file the RIPGREP_CONFIG_PATH environment variable setting it to a "dummy" value (so it does not load a custom ripgrep config in claude code)! ``json { "env": { "RIPGREP_CONFIG_PATH": "dummy" }, } ` The USE_BUILTIN_RIPGREP env variable (as others have mentioned helped them) did NOT work for me for some reason, but RIPGREP_CONFIG_PATH did work! NOTE: This actually solved FOUR different issues for me!! 1. /agents not showing up 2. @ file autocompletion not working properly 3. /custom-slash-commands` not showing up 4. Search / Grep tools always showing "0 results found" I am going to link all the issues that relate to these problems below so that this message shows up linked in those comments! - https://github.com/anthropics/claude-code/issues/2288 - https://github.com/anthropics/claude-code/issues/1843 - https://github.com/anthropics/claude-code/issues/5284 - https://github.com/anthropics/claude-code/issues/5256 - https://github.com/anthropics/claude-code/issues/5185 - https://github.com/anthropics/claude-code/issues/5182 - https://github.com/anthropics/claude-code/issues/5062 - https://github.com/anthropics/claude-code/issues/4632

_Originally posted by @GitMurf in #4741_

View original on GitHub ↗

11 Comments

github-actions[bot] · 12 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4741
  2. https://github.com/anthropics/claude-code/issues/5256
  3. https://github.com/anthropics/claude-code/issues/4946

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

ant-kurt collaborator · 12 months ago

What's in your ~/.config/.ripgreprc, i.e. does finding zero results align with the exclusions you have set?

If not, can you run claude --debug and see if you have any rg / ripgrep errors logged?

corneliusroemer · 12 months ago

@ant-kurt this is my ripgreprc:

$ cat $HOME/.config/ripgrep/.ripgreprc
--hidden
--glob
!.git/

and the exclusions don't align - i.e. if Claude runs ripgrep SOMETHING it will find stuff while its own Search() tool won't.

And this is the relevant debug log: rg error (signal=null, code=2, stderr: rg: unrecognized flag --ripgrep
), 0 results

⏺ I'll use the Grep tool to search for files. Let me search for Python files:
[DEBUG] executePreToolHooks called for tool: Grep
[DEBUG] Executing hooks for PreToolUse:Grep
[DEBUG] Getting matching hook commands for PreToolUse with query: Grep
[DEBUG] Found 0 hook matchers in settings
[DEBUG] Matched 0 unique hooks for query "Grep" (0 before deduplication)
[DEBUG] Found 0 hook commands to execute
[DEBUG] rg error (signal=null, code=2, stderr: rg: unrecognized flag --ripgrep
), 0 results
[DEBUG] Executing hooks for PostToolUse:Grep
[DEBUG] Getting matching hook commands for PostToolUse with query: Grep
[DEBUG] Found 0 hook matchers in settings
[DEBUG] Matched 0 unique hooks for query "Grep" (0 before deduplication)
[DEBUG] Found 0 hook commands to execute

⏺ Search(pattern: "def", type: "py")
  ⎿  Found 0 files
[DEBUG] Stream started - received first chunk

⏺ No Python files with function definitions found in the current directory. Let me try searching for any files containing "config":
[DEBUG] executePreToolHooks called for tool: Grep
[DEBUG] Executing hooks for PreToolUse:Grep
[DEBUG] Getting matching hook commands for PreToolUse with query: Grep
[DEBUG] Found 0 hook matchers in settings
[DEBUG] Matched 0 unique hooks for query "Grep" (0 before deduplication)
[DEBUG] Found 0 hook commands to execute
[DEBUG] rg error (signal=null, code=2, stderr: rg: unrecognized flag --ripgrep
), 0 results
[DEBUG] Executing hooks for PostToolUse:Grep
[DEBUG] Getting matching hook commands for PostToolUse with query: Grep
[DEBUG] Found 0 hook matchers in settings
[DEBUG] Matched 0 unique hooks for query "Grep" (0 before deduplication)
[DEBUG] Found 0 hook commands to execute
zfogg · 11 months ago

this is a major problem for me too. here's what i have

# Don't let ripgrep vomit really long lines to my terminal, and show a preview.
--max-columns=150
--max-columns-preview

--line-number
--trim

#--column

--follow
--hidden
--pretty

--smart-case

--max-depth=6

#--before-context=1
#--after-context=1

--ignore
#--ignore-dot
--ignore-file=/Users/loomen/.config/rg/rgignore
--ignore-parent
--ignore-global
--ignore-vcs
corneliusroemer · 11 months ago

Note that the workaround with bogus env variable works for me.

I've created a StackOverflow Q&A to increase visibility of the issue and the workaround: https://stackoverflow.com/questions/79759550/claude-codes-internal-search-tool-always-shows-0-results-even-when-it-should-o/79759551#79759551

corneliusroemer · 11 months ago

@ant-kurt I see this is tagged as platform:linux but I encountered it on macOS. Might be unix-wide.

zfogg · 11 months ago

confirmed it exists on macos and linux. i'm still using this fix on Arch WSL and macOS and it works but there are bugs when Claude decides to use ripgrep sometimes. Please fix

zfogg · 10 months ago

I had RIPGREP_CONFIG_PATH set to a custom path and claude-code hates that.

here's a fix from my dotfiles:

# Claude Code
function claude() {
    if [ -f $HOME/.claude/local/claude ]; then
        local _claude="$HOME/.claude/local/claude"
    elif [ -f "$HOME/.local/bin/claude" ]; then
        local _claude="$HOME/.local/bin/claude"
    else
        local _claude=$(
            for dir in `echo $PATH | tr ':' '\n'`; do
                if [ -x "$dir/claude" ]; then
                    echo "$dir/claude"
                    break
                fi
            done
        )
    fi
    if [[ ! -v _claude ]] || [[ -z "$_claude" ]]; then
        >&2 echo "‼️ Couldn't find a local claude"
        exit 252833 # "claude" on a phone dial pad
    fi

    if [[ -v RIPGREP_CONFIG_PATH ]]; then
        local _old_ripgrep_config_path="$RIPGREP_CONFIG_PATH"
        unset RIPGREP_CONFIG_PATH
    fi

    $_claude

    if [[ -v _old_ripgrep_config_path ]]; then
        export RIPGREP_CONFIG_PATH="$_old_ripgrep_config_path"
    fi
}
corneliusroemer · 10 months ago

Now on latest Claude I suddenly get issues when Claude calls ripgrep through bash (having the above dummy workaround in my claude config):

⏺ Bash(rg "entries_with_(complete_raw_read|incomplete_raw_read|ext_metadata|external_metadata)" /Users/cr/code/loculus/ena-submission/scripts/get_ena_submission_list.p…)
  ⎿      all_entries_with_external_metadata = entries_with_raw_read_links | entries_with_insdc_accessions
                 not in (all_entries_with_external_metadata | revoked_entries)
     rg: failed to read the file specified in RIPGREP_CONFIG_PATH: dummy: No such file or directory (os error 2)

I fixed that by creating an empty file .emptyripgreprc that I then use instead of dummy:

{
  "env": {
    "RIPGREP_CONFIG_PATH": "/Users/cr/.config/ripgrep/.emptyripgreprc"
  }
}
ant-kurt collaborator · 10 months ago

Hey folks - this should be resolved in the next release, which also drops support for custom ripgrep configs in Claude Code.

github-actions[bot] · 9 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.