Built-in ripgrep EAGAIN timeout on startup in repos with large gitignored directories (regression in 2.1.27)
Description
After upgrading to Claude Code 2.1.27 (Homebrew cask), starting a session in a dotfiles repo causes Claude Code's built-in ripgrep to time out on startup. This did not happen in the previous version.
Evidence
System ripgrep works fine on the same directory:
$ cd ~/macdotfiles && rg --files | wc -l
102
# Completes in 0.01s — .gitignore respected correctly
$ rg --no-ignore --files .config/ | wc -l
11547
# Even without gitignore, completes in 0.045s
Claude Code's built-in ripgrep fails:
From the debug log (~/.claude/debug/<session-id>.txt):
[DEBUG] Ripgrep first use test: PASSED (mode=builtin, path=/opt/homebrew/Caskroom/claude-code/2.1.27/claude)
[DEBUG] rg EAGAIN error detected, retrying with single-threaded mode (-j 1)
[DEBUG] rg error (signal=undefined, code=ABORT_ERR, stderr: ), 0 results
[ERROR] AbortError: The operation was aborted.
[ERROR] RipgrepTimeoutError: Ripgrep search timed out after 20 seconds. The search may have matched files but did not complete in time.
The built-in ripgrep hits an EAGAIN (resource temporarily unavailable) error, retries in single-threaded mode (-j 1), and then times out at 20 seconds. The session appears to freeze/hang.
Reproduction
- Have a git repo (~960 MB on disk, ~170 MB tracked) where
~/.configand~/.vimare whole-directory symlinks into the repo - The repo contains gitignored auto-generated content:
~/.config/coc/(592 MB, coc.nvim extensions with deeply nested node_modules) and~/.vim/plugged/(~200 MB, 20 vim plugins with nested.gitdirs) - The
.gitignorecorrectly handles these with deny-all + re-include patterns - Start Claude Code in this repo → built-in ripgrep times out, session freezes
Expected behavior
Claude Code's built-in ripgrep should handle this directory at least as well as system ripgrep (which completes in 0.01s).
Workaround
Deleting ~/.claude/projects/-Users-<username>-<repo>/ (project cache) allows Claude Code to start, but the issue may recur.
Environment
- Claude Code version: 2.1.27
- Installation: Homebrew cask (
/opt/homebrew/Caskroom/claude-code/2.1.27/claude) - macOS (Apple Silicon)
- Bun runtime
- System ripgrep: works correctly on the same directory
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗