[BUG] Vendored ripgrep won't launch if Claude Code is installed into a directory with a space in the path
Status Fixed / completed
Maintainer reply ✓ Yes — rboyce-ant
Workaround ✓ Mentioned in thread ↓
Activity 9 comments · opened Apr 9, 2025 · closed May 14, 2025
💡 Likely answer: A maintainer (rboyce-ant, contributor)
responded on this thread — see the highlighted reply below.
Environment
- Platform (select one):
- [X] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 0.2.66
- Operating System: macOS Sequoia 15.1.1
- Terminal: iTerm2, Terminal App
Bug Description
The Search step always returns no results even for trivial patterns. This makes Claude use a lot more resources to read files looking for things.
Steps to Reproduce
- Create a new "project" directory, named
foo. cd foo- Create a new file called
womble.pywith the contents:
def cabbage():
return "cabbage"
- Run
claude --verbose --debug --mcp-debug - Tell Claude to "search for the "cabbage" function using only the search feature"
Expected Behavior
I expected the "Search" tool to be invoked and for it to find the function with that alone.
Actual Behavior
The Search tool finds nothing. Telling Claude to read the file and look for the function shows it can do that though.
Additional Context
<img width="1169" alt="Image" src="https://github.com/user-attachments/assets/bb9a0a41-86a1-4990-85bd-91483c58c2ef" />
9 Comments
Honestly they should try getting embeddings for files and searching by those as well. I've gotten great results and cost to get embeddings even for 1000 files is negligible.
Kind of neither here nor there, quite likely live Search would be good enough if there wasn't something categorically wrong with it that makes it not work (on my machine?) Frankly the quoted
"undefined"above bothers me, is it possible it's trying to tell the tool to search all files but accidentally stringifies the JSundefinedresulting in a path that doesn't exist?For some reason, Claude is passing the string "undefined" as the path argument. Do you have something in your CLAUDE.md or elsewhere in the session that might be causing it to think that it needs to do that? I'm only able to reproduce this behavior if I tell Claude "be sure to pass "undefined" as the "path" argument to Search tool"
@rboyce-ant the screenie in the issue comes from a new session in a new directory with just
womble.pyin it; same behaviour happens in my actual work project, again without aCLAUDE.mdIf it's localized to anything, it seems to be my system rather than the project. Where does Claude store that sort of state? I could try wiping that to a clean slate.
I nuked
~/.claudeand~/.claude.json, uninstalled the claude code package, deleted leftovers in node'slib/, reinstalled, no dice. Tried to cluebat Claude into not passing a string"undefined"to the search tool, no dice.<img width="860" alt="Image" src="https://github.com/user-attachments/assets/a48391ee-23e6-46fc-a27d-74a24fd6c9b2" />
Further weirdness that could be related is that in my main project, sometimes a file glob gets passed as the "pattern" and that works?! Even though it seems that's what the "include" argument should be doing. Kind of at a loss at how to provide more useful diagnostic information here, since the inner workings of this are so opaque.
<img width="1348" alt="Image" src="https://github.com/user-attachments/assets/29bd9288-a98c-4152-b66c-3f8ca5e1daef" />
wait I think I got it
after running
cli.jsthroughprettierand making a wild guess that you're usingdebugfor logging, I got the following output:
Seems like the space in
Application Supportis getting escaped as%20, except that this isn't a URL, so trying to callripgrepjust fails completely.I would, you know, maybe not use
import.meta.urlto get paths into a Unix filesystem and then try to pass them to an API that does not, in fact, support URLs. Claude should also perhaps complain a bit more vocally about failing to spawn tools. This bug probably cost me a few bucks because Claude had to search for everything the hard way lolWorkaround is installing an external ripgrep.
Should be resolved in v0.2.114
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.