[BUG] Runaway Ripgrep Processes with Malformed Glob Patterns
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?
Similarity to Other Reports
Similar 'ripgrep' related bugs have been reported, but they do not consist of the following seen issues I encountered while using the VS Code extension and working on my hyprland config files (and other related configs) in my home directory. I felt it prudent to report the following for additional context in case this is helpful for the ongoing work on fixes.
I would like to also point out: this is my first bug report. Hopefully I'm doing this correctly! I'd appreciate advice or feedback for future reports I make. Thanks!
The following was generated by Claude Code after it analyzed the source of the recurring runaway rg processes.
Summary
Claude Code extension spawns runaway rg (ripgrep) processes that search the entire filesystem from root, causing severe system performance degradation (load average >140, 0% CPU idle).
Additional Context
- Bug occurred during a long conversation about Hyprland configuration optimization
- Multiple file references were made to paths like:
/home/user /.config/hypr/hyprland.conf/home/user /.config/hypr/hyprlock.conf/home/user /.config/waybar/style.css/home/user /.config/foot/foot.ini- Each referenced file spawned 1-2 runaway ripgrep processes
- Issue persisted across multiple restarts of VS Code
- Killing all
rgprocesses immediately restored system responsiveness (load dropped from 147 to <1, CPU idle went from 0% to 96%)
Reproducibility
High - Occurs consistently when:
- Long conversations with many file references
- Files referenced using absolute paths
- Files located outside typical code directories (e.g., dotfiles in
~/.config/)
What Should Happen?
Expected Behavior
- Ripgrep should search only within the workspace/project directory
- File indexing should use correct glob patterns relative to workspace root
- System should remain responsive during background indexing
Actual Behavior
- Multiple ripgrep processes spawn and never complete
- Each process runs at 200-300% CPU usage continuously
- System load average climbs to 140+ (on 8-16 core system)
- System becomes completely unresponsive (lag in all applications, even typing)
- Processes must be manually killed with
pkill -9 rg
Root Cause Analysis
Malformed Glob Patterns
The ripgrep processes are invoked with glob patterns that start with /, causing them to search from filesystem root:
# Example of malformed command (INCORRECT):
/opt/visual-studio-code/resources/app/node_modules/@vscode/ripgrep/bin/rg \
--files --hidden --case-sensitive --no-require-git \
-g /.config/hypr/hyprland.conf \ # ❌ Leading slash causes root search
-g !**/.git -g !**/.svn -g !**/.hg \
--no-ignore --follow --no-config --no-ignore-global
What Should Happen
Glob patterns should be relative to workspace or use **/ prefix:
# Correct patterns:
-g .config/hypr/hyprland.conf # Relative to workspace
-g **/.config/hypr/hyprland.conf # Match anywhere in workspace tree
Error Messages/Logs
## System Logs
No relevant errors in journalctl. Processes appear to be "working as intended" from their perspective - they're searching the entire filesystem because that's what the malformed glob pattern requested.
### Process List During Bug
$ ps aux | grep "rg " | head -5
user 70835 48256 99 10:57 ? 00:17:54 /opt/visual-studio-code/.../rg --files ... -g /.config/hypr/hyprland.conf ...
user 71506 48256 99 10:58 ? 00:07:51 /opt/visual-studio-code/.../rg --files ... -g /.config/hypr/hyprpaper.conf ...
user 71521 48256 99 10:58 ? 00:09:53 /opt/visual-studio-code/.../rg --files ... -g /.config/hypr/hyprlock.conf ...
user 71688 48256 99 10:59 ? 00:05:34 /opt/visual-studio-code/.../rg --files ... -g /.config/hypr/hyprlock.conf ...
user 71776 48256 99 10:59 ? 00:04:49 /opt/visual-studio-code/.../rg --files ... -g /.config/hypr/hyprlock.conf ...
### System Impact
$ top -b -n 1 | head -12
top - 10:44:22 up 1 day, 34 min, 2 users, load average: 147.80, 124.31, 82.44
Tasks: 394 total, 3 running, 390 sleep, 1 d-sleep, 0 stopped, 0 zombie
%Cpu(s): 4.9 us, 94.1 sy, 0.0 ni, 0.0 id, 0.0 wa, 1.0 hi, 0.0 si, 0.0 st
MiB Mem : 22834.8 total, 255.9 free, 12429.3 used, 10408.5 buff/cache
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
65179 user 20 0 95180 49352 3244 S 777.4 0.2 6:52.52 rg
60765 user 20 0 92620 52196 3244 S 210.5 0.2 14:47.79 rg
61664 user 20 0 95180 60920 3244 S 97.2 0.3 16:18.19 rg
60459 user 20 0 92620 64212 3244 S 81.0 0.3 23:57.63 rg
**Critical**: Load average of 147 with 0% CPU idle, system completely unusable.
### Process Tree
$ pstree -p | grep "rg("
code(48256)─┬─rg(49097)─┬─{rg}(49098)
├─rg(59971)─┬─{rg}(59980)
├─rg(60391)─┬─{rg}(60392)
├─rg(60459)─┬─{rg}(60460)
├─rg(60765)─┬─{rg}(60766)
... (15+ total rg processes)
All processes are children of VS Code (PID 48256).
Steps to Reproduce
Trigger Mechanism
The bug appears to trigger when:
- Claude Code assistant references files using absolute paths in responses
- VS Code's file indexer attempts to make these files "clickable" for navigation
- The indexer converts absolute paths to glob patterns incorrectly
- Leading
/in paths like/home/user/.config/...becomes-g /.config/... - Ripgrep interprets this as "search from filesystem root for paths matching
/.config/..."
Steps to Reproduce
- Have an extended conversation with Claude Code that references configuration files using absolute paths
- Use markdown file references in responses (e.g.,
[hyprlock.conf](file:///home/user/.config/hypr/hyprlock.conf)) - Allow conversation to continue with multiple file references
- Monitor system processes:
ps aux | grep rg - Observe multiple
rgprocesses spawned, each consuming 200-300% CPU
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.8
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
Environment
- OS: Linux (Arch-based, kernel 6.16.10-arch1-1)
- VS Code Version: Latest (visual-studio-code package)
- Claude Code Extension: Latest version installed
- Ripgrep Location:
/opt/visual-studio-code/resources/app/node_modules/@vscode/ripgrep/bin/rg - Working Directory:
/home/user - Session Type: Hyprland (Wayland compositor)
Impact Severity
Critical - System becomes completely unusable:
- User cannot type (input lag in all applications)
- Applications freeze or respond with multi-second delays
- Hard reboot sometimes required if processes spawn faster than they can be killed
- Data loss risk from forced reboots
Workaround
EDIT: previous scripts were failing to find the runaway processes, required better
logic to find them; I run this as a cron task every 3 minutes currently to hunt them
down. Seems to be working for now.
EDIT2: better discovery of rg processes and dropped threshold down to 2 minutes for
runaway detection
#!/usr/bin/env bash
# Kills runaway ripgrep processes from VS Code
# This is a workaround for VS Code indexer bugs
# Find VS Code rg PIDs by full binary path
RG_PIDS=$(pgrep -f "/opt/visual-studio-code/resources/app/node_modules/@vscode/ripgrep/bin/rg")
if [ -z "$RG_PIDS" ]; then
echo "No VS Code ripgrep processes found"
echo "Current load:$(uptime | awk -F'load average:' '{print $2}')"
exit 0
fi
# Check each PID's runtime
RUNAWAY_RG=""
for pid in $RG_PIDS; do
# Get elapsed time for this PID
etime=$(ps -p "$pid" -o etime= 2>/dev/null | tr -d ' ')
if [ -z "$etime" ]; then
continue
fi
# Parse time (MM:SS or HH:MM:SS or DD-HH:MM:SS)
if [[ "$etime" == *"-"* ]]; then
# Has days (DD-HH:MM:SS)
IFS='-:' read -ra time <<< "$etime"
minutes=$(( 10#${time[0]} * 24 * 60 + 10#${time[1]} * 60 + 10#${time[2]} ))
else
# Split by colon
IFS=':' read -ra time <<< "$etime"
if [ ${#time[@]} -eq 3 ]; then
# HH:MM:SS
minutes=$(( 10#${time[0]} * 60 + 10#${time[1]} ))
elif [ ${#time[@]} -eq 2 ]; then
# MM:SS - force base 10 to avoid octal interpretation
minutes=$((10#${time[0]}))
else
# Unknown format, skip
continue
fi
fi
# If running more than 2 minutes, add to kill list
if [ "$minutes" -gt 2 ]; then
RUNAWAY_RG="$RUNAWAY_RG $pid"
fi
done
if [ -n "$RUNAWAY_RG" ]; then
COUNT=$(echo "$RUNAWAY_RG" | wc -l)
echo "Found $COUNT runaway ripgrep process(es), killing..."
echo "$RUNAWAY_RG" | xargs kill -9 2>/dev/null
echo "✓ Killed runaway rg processes"
else
echo "No runaway rg processes found"
fi
# Show current system load
echo "Current load:$(uptime | awk -F'load average:' '{print $2}')"This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗