# Agent Grep & Glob tools return empty for every query

**URL:** <https://forum.cursor.com/t/agent-grep-glob-tools-return-empty-for-every-query/161923>\
**Category:** Bug Reports\
**Tags:** macos, context\
**Created:** [May 29, 2026, 5:23pm UTC](https://forum.cursor.com/t/agent-grep-glob-tools-return-empty-for-every-query/161923 "2026-05-29T17:23:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phil\_1](https://avatars.discourse-cdn.com/v4/letter/p/59ef9b/32.png) [@Phil\_1](https://forum.cursor.com/u/Phil_1)\
**Post date:** [May 29, 2026, 5:23pm UTC](https://forum.cursor.com/t/agent-grep-glob-tools-return-empty-for-every-query/161923/1 "2026-05-29T17:23:36Z")

</div>

### 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/rg` → `ripgrep 15.1.0-cursor5`, 8,539,888 bytes, mode 100755, `rgPathExists: true`
- System ripgrep also installed: `/opt/homebrew/bin/rg` → `ripgrep 15.1.0`

## Symptoms

- **Glob** → `Result 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/`.
- **Grep** → `No 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):

```auto
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:

```auto
[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:

```auto
[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

---

<div class="post-metadata">

**Author:** ![mohitjain](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/mohitjain/32/100229_2.png) [@mohitjain](https://forum.cursor.com/u/mohitjain)\
**Post date:** [June 1, 2026, 11:06am UTC](https://forum.cursor.com/t/agent-grep-glob-tools-return-empty-for-every-query/161923/6 "2026-06-01T11:06:28Z")

</div>

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:

```auto
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](https://www.anand-iyer.com/blog/2018/a-simpler-way-to-manage-your-dotfiles/) (no `~/.git` directory). That way you can re-enable the indexed grep for the speed benefit.

You may also find [this related thread](https://forum.cursor.com/t/agent-grep-and-glob-tools-return-zero-results-for-all-calls/158833) helpful — same symptoms, same confirmed root cause.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [July 18, 2026, 4:56pm UTC](https://forum.cursor.com/t/agent-grep-glob-tools-return-empty-for-every-query/161923/8 "2026-07-18T16:56:47Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
