gemini-cli - 💡(How to fix) Fix Bug: Ripgrep binary path resolution failure in npm distribution (Windows)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Gemini CLI 0.42.0 fails to locate the bundled Ripgrep binary on Windows, falling back to the slower GrepTool. This occurs because the binary resolution logic exclusively searches for a specific internal path which is missing in the npm distribution.

Root Cause

In bundle/chunk-7VVHSNDQ.js (or the equivalent source packages/core/src/tools/ripGrep.ts), the getRipgrepPath() function constructs candidate paths based on __dirname:

const candidatePaths = [
  // 1. SEA runtime layout
  path.resolve(__dirname, "vendor/ripgrep", binName),
  // 2. Dev/Dist layout
  path.resolve(__dirname, "../../vendor/ripgrep", binName)
];

In the npm-installed version (global), __dirname resolves to .../node_modules/@google/gemini-cli/bundle/. However:

  1. .../node_modules/@google/gemini-cli/bundle/vendor/ripgrep/ does not exist.
  2. .../node_modules/@google/gemini-cli/vendor/ripgrep/ does not exist.

The npm package structure lacks the vendor/ripgrep folder entirely.

Code Example

const candidatePaths = [
  // 1. SEA runtime layout
  path.resolve(__dirname, "vendor/ripgrep", binName),
  // 2. Dev/Dist layout
  path.resolve(__dirname, "../../vendor/ripgrep", binName)
];
RAW_BUFFERClick to expand / collapse

Bug Report: Ripgrep Binary Path Resolution Issue in Gemini CLI 0.42.0

Summary

Gemini CLI 0.42.0 fails to locate the bundled Ripgrep binary on Windows, falling back to the slower GrepTool. This occurs because the binary resolution logic exclusively searches for a specific internal path which is missing in the npm distribution.

Environment

  • Gemini CLI Version: 0.42.0
  • OS: Windows 10/11 (win32)
  • Node.js: (npm distribution)
  • Ripgrep (System): ripgrep 15.1.0 installed (but ignored)

Root Cause Analysis

In bundle/chunk-7VVHSNDQ.js (or the equivalent source packages/core/src/tools/ripGrep.ts), the getRipgrepPath() function constructs candidate paths based on __dirname:

const candidatePaths = [
  // 1. SEA runtime layout
  path.resolve(__dirname, "vendor/ripgrep", binName),
  // 2. Dev/Dist layout
  path.resolve(__dirname, "../../vendor/ripgrep", binName)
];

In the npm-installed version (global), __dirname resolves to .../node_modules/@google/gemini-cli/bundle/. However:

  1. .../node_modules/@google/gemini-cli/bundle/vendor/ripgrep/ does not exist.
  2. .../node_modules/@google/gemini-cli/vendor/ripgrep/ does not exist.

The npm package structure lacks the vendor/ripgrep folder entirely.

Evidence

Running a search triggers the following internal event: EVENT_RIPGREP_FALLBACK = "gemini_cli.ripgrep_fallback"

Proposed Fixes

  1. Short-term: Include the vendor/ripgrep binaries in the npm package distribution.
  2. Long-term: Update getRipgrepPath() to check if rg or rg.exe is available in the system PATH as a secondary fallback before resorting to the non-ripgrep GrepTool.

Reported on: 2026-05-16

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING