[BUG] Ripgrep breaks _everything_
Environment
- Platform (select one):
- [X] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other:
- Claude CLI version: v1.0.63
- Operating System: Ubuntu 22.04
- Terminal: bash
Bug Description
When you have rg (RipGrep) installed on your system, Claude will try to use it. However, there's something wrong with Claude's usage of it, it will always return "(no content)" (or similar).
If you tell Claude to execute Bash(rg something) .. it will return a blank. Even Bash(rg --version) will return an empty result.
However, if you tell Claude to pipe output to cat, e.g. Bash(rg --version | cat) ... then it will work. Ripgrep is basically detecting that Claude is not running in an interactive terminal (or some other jazz that I don't understand) and it won't output. I've seen this with other CLI tools, too, but rg is the most significant.
I'm not sure if this only applies to a certain version, or what, but calls to rg will always fail.
So, this was breaking my Search() tool and lots of other things. Slash commands were not being detected, agent files were not being detected, etc.
Steps to Reproduce
- Be me, or someone working on my Ubuntu VM (sorry, idk what's special about my env)
- Use the claude Search tool, or try to use slash commands, or agents
Expected Behavior
They should all work.
Actual Behavior
They don't work.
Additional Context
As a workaround, adding this to your settings.json will fix everything:
{
"env": {
"USE_BUILTIN_RIPGREP": 1
},
Here's my rg info:
$ rg --version
ripgrep 12.1.0 (rev 1980630f17)
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)
10 Comments
I found a rg config issue which was messing my up : #4946
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.jsonfile theRIPGREP_CONFIG_PATHenvironment variable setting it to a "dummy" value (so it does not load a custom ripgrep config in claude code)!The
USE_BUILTIN_RIPGREPenv variable (as others have mentioned helped them) did NOT work for me for some reason, butRIPGREP_CONFIG_PATHdid work!NOTE: This actually solved FOUR different issues for me!!
/agentsnot showing up@file autocompletion not working properly/custom-slash-commandsnot showing upI am going to link all the issues that relate to these problems below so that this message shows up linked in those comments!
FYI I don't have a
~/.config/.ripgreprcon my linux systems but still seeing the 0 search results while normal grep works.@pseudotensor do your
/agentsand custom slash commands all show up? Does your@tab file autocompletion work? I was having all of these problems plus the Search tool problems, and this solved them all!@pseudotensor here is without the fix to ignore ripgreprc... 0 results
<img width="505" height="103" alt="Image" src="https://github.com/user-attachments/assets/c6d4e16b-6520-4d7a-bfda-351de4566d10" />
And here it is after I get the ripgreprc ignored! ... 1 result
<img width="548" height="96" alt="Image" src="https://github.com/user-attachments/assets/78c0c43d-a6b6-4d87-a2de-5e72a07c4361" />
Maybe I just made stupid mistake, but on the system I didn't have ripgrep installed, now it is working after installing it. I'll keep your point in mind about the config file.
Seems claude code should have said ripgrep wasn't installed if it's going to fail and find 0 results for everything. Maybe it uses something else if ripgrep isn't around that is bad.
I would assume it fallsback to regular grep if ripgrep is not installed 🤷♂️
Either way it seems that indeed the main culprit in all these similar Claude Code issues have to do with
ripgrep.We shipped some improvements in 1.0.84 that should help diagnose / mitigate this:
See the above troubleshooting link if you're still having issues.
Started to experience the same after last update @ant-kurt .
Making it to use the system ripgrep worked, but the built-in one was broken just recently
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.