Skip to content

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

Closed as not planned

Description

@the3asic

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 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.

Activity

  1. added
    perfIndicates a performance issue or need for optimization
    on Feb 12, 2026
  2. tupton commented on Mar 23, 2026

    @tupton

    I'm seeing this exact issue on Mac OS 26.3.1 (ARM64), so it is not limited to Linux.

  3. zhang185na commented on Mar 25, 2026

    @zhang185na

    I've been stuck with the same problem for a few days.
    OpenCode version: 1.3.2 (Installed by brew)
    OS: macOS 15.0 Sequoia (ARM64/arm64)
    rg binary: /opt/anaconda3/bin/rg (ripgrep 11.0.2)

  4. tupton commented on Apr 24, 2026

    @tupton

    I am still seeing this behavior. I have worked around it by putting instructions in ~/.config/opencode/AGENTS.md to not use the Grep tool and instead use rg:

    # Global Rules
    
    ## Tool Usage
    
    Grep tool is broken on Apple Silicon (returns "No files found" always); see https://github.com/anomalyco/opencode/issues/13353. Use `rg` via Bash instead. Glob and Read tools work fine.
    
    - `rg "pattern" -tts -tjs` — filter by file type (`rg --type-list` for all types)
    - `rg "pattern" path/` — scoped search
    - `rg "pattern" --glob '*.tsx'` — manual glob (prefix `!` to exclude; use single quotes)

    But I would rather not have to use this for every session.

  5. removed
    perfIndicates a performance issue or need for optimization
    on May 3, 2026
  6. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions