Grep tool returns "No files found" for all searches on ARM64 Linux #9189

Open
opened 2026-02-16 18:11:51 -05:00 by yindo · 0 comments
Owner

Originally created by @the3asic on GitHub (Feb 12, 2026).

Originally assigned to: @rekram1-node on GitHub.

Environment

  • OpenCode version: 1.1.61
  • OS: Ubuntu 20.04 LTS (ARM64/aarch64)
  • glibc: 2.31
  • rg binary: ~/.local/share/opencode/bin/rg (ripgrep 14.1.1)

Description

The built-in Grep tool returns "No files found" for every search, regardless of pattern, path, or include parameters. This has persisted across multiple OpenCode versions.

Reproduction

Any Grep tool call returns empty:

Grep(pattern="import", path="/home/user/project")        → No files found
Grep(pattern="import", include="*.py")                    → No files found
Grep(pattern="def ")                                      → No files found

Meanwhile, running the exact same rg binary with the same arguments from shell works perfectly:

# OpenCode's own rg binary, same args as grep.ts builds
~/.local/share/opencode/bin/rg -nH --hidden --no-messages \
  --field-match-separator='|' --regexp "import" --glob "*.py" /home/user/project
# → returns 20+ matches

Key observations

  1. All Grep searches return empty — not pattern-specific, not path-specific
  2. Glob tool works fineGlob(pattern="**/*.py") finds files correctly
  3. Shell rg works fine — identical binary, identical arguments, produces results
  4. Duration ~0ms in logsservice=tool.registry status=completed duration=0 grep, suggesting the tool completes almost instantly without actually executing rg
  5. The issue is not related to --follow / symlinks (tested: same results with and without symlinks)
  6. The issue is not related to .gitignore filtering (files are git-tracked)

Analysis

Based on source code review of grep.ts:

  • grep.ts uses Bun.spawn([rgPath, ...args]) with stdout: "pipe" and signal: ctx.abort

  • The near-zero execution time suggests either:

    • Bun.spawn stdout pipe returns empty on ARM64 Linux
    • ctx.abort AbortSignal is pre-triggered, killing the process immediately
    • Some other Bun runtime issue on ARM64 + glibc 2.31
  • Ripgrep.files() (used by Glob) likely uses a different code path, which is why Glob works but Grep doesn't.

Expected behavior

Grep tool should return matching files and line numbers, consistent with direct rg execution.

Originally created by @the3asic on GitHub (Feb 12, 2026). Originally assigned to: @rekram1-node on GitHub. ## Environment - OpenCode version: 1.1.61 - OS: Ubuntu 20.04 LTS (ARM64/aarch64) - glibc: 2.31 - rg binary: ~/.local/share/opencode/bin/rg (ripgrep 14.1.1) ## Description The built-in Grep tool returns "No files found" for **every** search, regardless of pattern, path, or include parameters. This has persisted across multiple OpenCode versions. ## Reproduction Any Grep tool call returns empty: ``` Grep(pattern="import", path="/home/user/project") → No files found Grep(pattern="import", include="*.py") → No files found Grep(pattern="def ") → No files found ``` Meanwhile, running the **exact same rg binary** with the **same arguments** from shell works perfectly: ```bash # OpenCode's own rg binary, same args as grep.ts builds ~/.local/share/opencode/bin/rg -nH --hidden --no-messages \ --field-match-separator='|' --regexp "import" --glob "*.py" /home/user/project # → returns 20+ matches ``` ## Key observations 1. **All Grep searches return empty** — not pattern-specific, not path-specific 2. **Glob tool works fine** — `Glob(pattern="**/*.py")` finds files correctly 3. **Shell rg works fine** — identical binary, identical arguments, produces results 4. **Duration ~0ms in logs** — `service=tool.registry status=completed duration=0 grep`, suggesting the tool completes almost instantly without actually executing rg 5. The issue is **not** related to `--follow` / symlinks (tested: same results with and without symlinks) 6. The issue is **not** related to `.gitignore` filtering (files are git-tracked) ## Analysis Based on source code review of `grep.ts`: - `grep.ts` uses `Bun.spawn([rgPath, ...args])` with `stdout: "pipe"` and `signal: ctx.abort` - The near-zero execution time suggests either: - `Bun.spawn` stdout pipe returns empty on ARM64 Linux - `ctx.abort` AbortSignal is pre-triggered, killing the process immediately - Some other Bun runtime issue on ARM64 + glibc 2.31 - `Ripgrep.files()` (used by Glob) likely uses a different code path, which is why Glob works but Grep doesn't. ## Expected behavior Grep tool should return matching files and line numbers, consistent with direct rg execution.
yindo added the perf label 2026-02-16 18:11:51 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9189