Skip to content

X-15/claude-code-rg-patcher

Repository files navigation

Claude Code: Ripgrep Patcher

A small VSCode extension that fixes the spawn rg.exe ENOENT error in the Anthropic Claude Code VSCode extension on Windows.

Why this exists

Starting in Claude Code v2.1.113, the extension switched from a JavaScript CLI (which bundled its own rg.exe) to a single statically-compiled claude.exe native binary. The new VSIX no longer ships rg.exe, but the extension code still tries to spawn it for file searches:

[error] Ripgrep search failed A system error occurred (spawn rg.exe ENOENT)
[warning] Ripgrep search failed, falling back to VSCode findFiles: Error: spawn rg.exe ENOENT

When this happens, @-mention file completion in the Claude Code panel becomes very slow because it falls back to VSCode's findFiles API.

Tracking issues upstream: anthropics/claude-code#34595, #22229, #22568.

What it does

Install once and forget. On VSCode startup, this extension scans for any anthropic.claude-code-<version>-win32-x64/ folder under:

  • ~/.vscode/extensions/
  • ~/.vscode-insiders/extensions/

…and only when resources/native-binary/rg.exe is missing, copies in the bundled ripgrep 15.1.0 binary. If a file is already there — even one with a different hash — the extension leaves it alone. This means:

  • If Anthropic ever ships their own rg.exe in a future Claude Code release, this extension will silently step out of the way without downgrading or replacing their build.
  • If a previous patch placed our binary, subsequent activations no-op silently (size + mtime fast-path before any hashing).

It also:

  • Listens to vscode.extensions.onDidChange to react instantly when Claude Code is installed, updated, or uninstalled — no waiting on file watchers.
  • Watches both extensions directories at runtime as a backstop (debounced 1.5 s, with self-write echo suppression).
  • Polls every 10 minutes as a final safety net for any missed events.
  • Removes broken symlinks under ~/.claude/debug/ (typically a stale latest symlink) that cause rg --follow to error.
  • Logs everything to the Claude Code: Ripgrep Patcher output channel.

UX: silent unless something happened

Situation Toast Log
Patch needed and applied ✅ Info toast: "patched rg.exe in N install(s)" full detail
rg.exe already correct (no work) ❌ silent one debug line
rg.exe present but differs from bundled (likely upstream) ❌ silent one info line ("PRESERVED…")
Patch failed (permission, AV lock, etc.) ⚠️ Warning toast (with "Don't show again") error + stack

Install

Download the latest .vsix from the Releases page and:

# VSCode Stable
code --install-extension claude-code-rg-patcher-0.1.0@win32-x64.vsix

# VSCode Insiders
code-insiders --install-extension claude-code-rg-patcher-0.1.0@win32-x64.vsix

Reload the VSCode window once after install. The patch runs automatically and silently from then on.

Verify it worked

Run the Claude Code RG Patcher: Show Status command from the Command Palette, or open the Claude Code: Ripgrep Patcher output channel. You should see lines like:

[info] activate: extension v0.1.0
[info] bundled rg.exe sha256: decdd4992f3f1b9a5ef9898f1b40ab16886d579d6516b4efd3d5eaa19364e408
[info] found 1 Claude Code install(s) under insiders: anthropic.claude-code-2.1.120-win32-x64
[info] PATCHED: copied bundled rg.exe -> C:\Users\…\anthropic.claude-code-2.1.120-win32-x64\resources\native-binary\rg.exe
[info] watcher: armed on C:\Users\…\.vscode-insiders\extensions
[info] polling enabled: every 10 min

Commands

  • Claude Code RG Patcher: Run Patch Now — re-scan and patch immediately.
  • Claude Code RG Patcher: Show Log — open the output channel.
  • Claude Code RG Patcher: Show Status — show lifetime stats for this VSCode session.

Settings

Setting Default Description
claudeCodeRgPatcher.enabled true Master switch.
claudeCodeRgPatcher.patchVscodeStable true Patch installs under ~/.vscode/extensions.
claudeCodeRgPatcher.patchVscodeInsiders true Patch installs under ~/.vscode-insiders/extensions.
claudeCodeRgPatcher.cleanupBrokenSymlinks true Remove broken symlinks under ~/.claude/debug.
claudeCodeRgPatcher.pollIntervalMinutes 10 Re-scan interval as a safety net. 0 disables polling.

Why a system-wide install isn't enough

The simplest workaround is scoop install ripgrep or winget install BurntSushi.ripgrep.MSVC — that puts rg.exe on PATH, and the Claude Code extension's execFile("rg.exe", ...) call resolves through Windows' CreateProcess PATH lookup. Yes, that's enough today, and you should consider it as an alternative.

This extension exists for users who:

  • Want a single, reproducible install that covers any future Claude Code update without manual re-checks.
  • Have constrained PATH environments (e.g. corporate Windows machines where they can't easily mutate user PATH).
  • Want a defensive copy directly in the extension folder in case Anthropic ever changes the spawn behavior to be path-relative.

Compatibility & scope

  • Platform: Windows x64 only. The VSIX is built with --target win32-x64; VSCode refuses to install it elsewhere. The bundled rg.exe is the official ripgrep x86_64-pc-windows-msvc build.
  • VSCode: Stable and Insiders, version 1.86 or later.
  • Patches: any anthropic.claude-code-<version>-win32-x64 install (matched by strict regex). Does not modify any other extension.
  • Remote scenarios: this extension runs on the local UI host (extensionKind: ["ui"]). If you're using Claude Code via Remote-SSH/WSL/Codespaces, install this patcher on the host where Claude Code's extension files live, not in the remote.

Uninstall

When you uninstall this extension, the rg.exe files we wrote into Claude Code's folders remain in place (we don't track or remove our writes). They get cleaned up automatically the next time Claude Code updates — VSCode wipes the old extension folder during update — at which point the original spawn rg.exe ENOENT issue would return unless you reinstall this patcher or use one of the alternatives below.

Bundled ripgrep

Item Value
Source https://github.com/BurntSushi/ripgrep
Version 15.1.0
Release https://github.com/BurntSushi/ripgrep/releases/tag/15.1.0
Build ripgrep-15.1.0-x86_64-pc-windows-msvc.zip
SHA-256 decdd4992f3f1b9a5ef9898f1b40ab16886d579d6516b4efd3d5eaa19364e408
License MIT or Unlicense (see RIPGREP-COPYING)

To verify your install matches the published binary, compare the SHA-256 of <extension>/rg.exe against the value above:

Get-FileHash <ext-path>\rg.exe -Algorithm SHA256

Build from source

Requirements: Node.js 18+ on Windows.

git clone https://github.com/X-15/claude-code-rg-patcher
cd claude-code-rg-patcher
npm install
npm run package    # produces claude-code-rg-patcher-<version>@win32-x64.vsix

License

MIT. Bundled rg.exe is dual-licensed MIT/Unlicense by Andrew Gallant — see RIPGREP-LICENSE-MIT, RIPGREP-UNLICENSE, RIPGREP-COPYING.

This extension is not affiliated with Anthropic, Microsoft, or BurntSushi/ripgrep. It's a community workaround for a known bug in the Claude Code VSCode extension.

About

Auto-patches the Anthropic Claude Code VSCode extension on Windows to fix the 'spawn rg.exe ENOENT' error.

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
MIT
RIPGREP-LICENSE-MIT
Unlicense
RIPGREP-UNLICENSE

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors