Agent Grep & Glob tools return empty for every query

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Agent Grep & Glob tools return empty for every query (ripgrep engine is healthy) — macOS

Summary

In the agent, the built-in Grep (content search) and Glob (file search) tools return zero results for every query, including patterns that obviously match. Meanwhile Cursor’s own indexing and rules-loading — which use the same ripgrep/ripwalk engine — work fine, ripgrep runs correctly from the CLI, and the Read/Shell tools work. The failure persists across Reload Window, full quit + relaunch, and a Cursor version update. This points to a defect in the cursor-agent-exec Grep/Glob tool path, not ripgrep, ignore files, repo-block, or workspace root.

Environment

  • Cursor: <fill from Cursor → About Cursor> (VS Code base 1.93.0; agent-exec Node v22.22.1)
  • OS: macOS 26.5 (build 25F71), Apple Silicon (arm64)
  • Workspace: single folder (monorepo), /Users/<me>/phacet/devenv/web-apps
  • Bundled ripgrep: …/Cursor.app/Contents/Resources/app/node_modules/@vscode/ripgrep/bin/rgripgrep 15.1.0-cursor5, 8,539,888 bytes, mode 100755, rgPathExists: true
  • System ripgrep also installed: /opt/homebrew/bin/rgripgrep 15.1.0

Symptoms

  • GlobResult of search in '<dir>': 0 files found for, e.g.: *.ts in a directory containing 11 .ts files; **/cell.service.ts repo-wide; **/*.mdc under .cursor/.
  • GrepNo files with matches found for CellService in a directory where 3 files contain it.

Reproduction

  1. Open a workspace folder on macOS (Apple Silicon).
  2. In the agent, call Glob with *.ts targeting a directory that contains .ts files → 0 files found.
  3. Call Grep for a string that exists → No files with matches found.
  4. Persists after Developer: Reload Window, full Cmd+Q relaunch, and updating Cursor.

Evidence

Engine + binary are healthy (only the agent tools fail):

  • CLI, using the exact flag set agent-exec builds, returns files (both bundled fork and Homebrew rg):
rg --files --hidden --no-require-git --no-config --color=never --iglob '**/cell.service.ts' <repo>   # → 2 files
  • agent-exec startup diagnostics: rg healthy, workspace correct, and no errors logged during the failing calls:
[info] rg_diagnostics.startup {"rgPath":".../@vscode/ripgrep/bin/rg","rgPathExists":true,"rgIsFile":true,"rgFileSize":8539888,"arch":"arm64","nodeVersion":"v22.22.1", ...}
[info] cursor_agent_exec.startup.workspace_paths {"workspacePaths":["/Users/<me>/myrepo"]}
  • Cursor’s own rules service used the same ripwalk/rg engine at startup and succeeded:
[info] LocalCursorRulesService load completed {"ruleCount":19}   # walks **/*.mdc
  • Indexer was actively completing file jobs throughout.

Key diagnostic — the tools never spawn ripgrep:

  • I temporarily replaced both the bundled rg and the PATH rg with a logging shim (forwarding to the real binary). During Grep/Glob tool calls the shim logged zero invocations, yet the tools still returned a normally-formatted 0 files found / No matches. So the tool path returns empty without executing (or without consuming the output of) ripgrep via either resolvable binary.

Ruled out

  • Not ignore files: no .cursorignore / .cursorindexingignore; .gitignore wouldn’t exclude .ts/.mdc, and CLI rg with the same flags returns them.
  • Not repo/admin block or privacy: Read and Shell tools work, and those handlers enforce the same isRepoBlocked gate (would otherwise return adminBlock: "Team repo blocklist"). The exact files Glob can’t find are readable via Read.
  • Not workspace root: logged workspacePaths is correct; an explicit absolute target_directory also returns 0.
  • Not a transient/degraded state: persists after full quit + relaunch and a version update.

Additional observations (for triage)

  • At session start there was no ripgrep on PATH (only the bundled copy) and both tools failed. After brew install ripgrep (rg now on PATH), the Grep tool began returning correct results in the same session without a reload — suggesting the tool path resolves ripgrep via PATH rather than the bundled rgPath it logs. However, Glob never recovered, and after restart + update (with rg on PATH) both fail again — so there may be a second, independent defect. If PATH resolution is intended, the tools should fall back to the bundled binary when system rg is absent.
  • In cursor-agent-exec, the Grep/Glob tool name + handler is selected by model/agent version (e.g., glob_file_search vs Glob; handlers Pte vs Lte). If handler selection is keyed on a version string that isn’t matched as expected for a given agent/model, the search may not run. (Speculative.)
  • Separate minor quirk: in the agent’s Shell tool, a bare leading rg command is executed as grep (rg --version prints grep (BSD grep, GNU compatible)), even though type/command -v/readlink resolve rg to real ripgrep. Only the agent Shell layer is affected; the user’s own terminal runs real rg. Likely unrelated, flagging for completeness.

Workaround

  • Shell rg --files -g '<glob>' (Glob replacement) and rg -l '<text>' / rg -n '<text>' (Grep replacement); Read for file contents.

Questions for the team

  1. Does the agent Grep/Glob tool resolve ripgrep via PATH or the bundled rgPath? If PATH, why no fallback to the bundled binary?
  2. Why does the same ripwalk/rg engine succeed for indexing/rules but the agent Grep/Glob tools return empty (no rg spawn, no error)?
  3. Is the version-gated handler selection (Pte/Lte) a factor for this agent/model?

Steps to Reproduce

  1. Open a workspace folder on macOS (Apple Silicon).
  2. In the agent, call Glob with *.ts targeting a directory that contains .ts files → 0 files found.
  3. Call Grep for a string that exists → No files with matches found.
  4. Persists after Developer: Reload Window, full Cmd+Q relaunch, and updating Cursor.

Operating System

MacOS

Version Information

Version: 3.6.21 (Universal)
VS Code Extension API: 1.105.1
Commit: e7a7e93f4d75f8272503ecf33cedbaae10114a10
Date: 2026-05-28T21:45:36.072Z
Layout: editor
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
xterm.js: 6.1.0-beta.220
OS: Darwin arm64 25.5.0

For AI issues: add Request ID with privacy disabled

ca43f662-3e9a-4eaf-999f-77ff63042c38

Additional Information

I am stepping out of cursor for now, every ai models spends 100k tokens on the start of each conversation blocking on this bug.

Does this stop you from using Cursor

Yes - Cursor is unusable

This is a known bug class. Your shim test nailing it down to “rg never spawned” is the key diagnostic - the agent’s indexed search path returns a valid empty result, so the ripgrep fallback never triggers.

Immediate fix: Open Cursor Settings and search for “Index Repositories for Instant Grep” - disable it, then reload the window (Cmd+Shift+P > Developer: Reload Window). This forces the agent to use direct ripgrep instead of the indexed path, and should restore Grep/Glob immediately.

The most common root cause for the index returning empty in single-root repos: a .git directory in a parent of your workspace (e.g., ~/.git for dotfiles versioning). Since your workspace is under your homedir, if you version dotfiles with git, the indexed search builds its file tree from the parent repo — which doesn’t track your project files — and returns “0 matches” for everything.

Could you check:

ls -d ~/.git ~/phacet/.git ~/phacet/devenv/.git 2>/dev/null

If a parent .git is the cause, the longer-term fix is switching to a bare-repo dotfiles setup (no ~/.git directory). That way you can re-enable the indexed grep for the speed benefit.

You may also find this related thread helpful — same symptoms, same confirmed root cause.