GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Grep Tool Fails on Symlinks · Issue #7498 · anomalyco/opencode

Grep Tool Fails on Symlinks #7498

New issue
Copy link
New issue
Copy link
Closed
#7501
Closed
Grep Tool Fails on Symlinks#7498
#7501
Copy link
Assignees
rekram1-node

Description

@kdcokenny
kdcokenny
opened on Jan 9, 2026
Issue body actions

Ran into an issue where grep returns "No files found" when working in directories with symlinked content. What's frustrating is that glob and list handle these cases just fine, so the behavior feels inconsistent and broken from a user perspective.

The Problem

When you run OpenCode from a symlink farm (think ln -s /real/project/src src), here's what happens:

  • glob **/*.ts works perfectly
  • list shows all the files you'd expect
  • grep "pattern" mysteriously finds nothing

How to Reproduce

Set up a quick test case:

mkdir /tmp/symlink-test && cd /tmp/symlink-test
ln -s /path/to/real/project/src src
ln -s /path/to/real/project/packages packages

Now run OpenCode from /tmp/symlink-test and try searching. glob and list cooperate, but grep gives you "No files found" every time.

Diving into the Code

The issue is pretty clear once you look at the implementation. There's an internal inconsistency in how ripgrep is called:

  • Ripgrep.search() (the internal function) skips the --follow flag
  • Ripgrep.files() (used by glob/list) correctly includes --follow

So the same tool behaves differently depending on which wrapper function you use.

The Weird Twist

Here's what got me: when ripgrep isn't available and the code falls back to standard grep -r, it actually works. That's because grep -r follows symlinks by default—ripgrep doesn't. So our "better" tool is actually what broke things.

Fix

Need to add --follow flag in two spots:

  1. packages/opencode/src/tool/grep.ts — the CLI args
  2. packages/opencode/src/file/ripgrep.ts — the Ripgrep.search args

That should make all the file-finding tools behave consistently across symlinked directories.

Reacted by Sumon Sinha and Xendarboh

Activity

  1. github-actions
    assigned
    rekram1-node
    on Jan 9, 2026
  2. github-actions commented on Jan 9, 2026

    @github-actions
    github-actionsBot
    on Jan 9, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of or related to existing issues. Please check:

    • perf: ripgrep config file search scans entire home directory including large hidden directories #6741: perf: ripgrep config file search scans entire home directory - Also involves ripgrep's --follow flag behavior and file discovery issues with symlinks (mentions the --follow flag specifically)
    • Can not switch the project in web mode #6978: Can not switch the project in web mode - Related symlink recognition issues when discovering projects/directories

    Feel free to ignore if none of these address your specific case.

  3. kdcokenny
    added a commit that references this issue on Jan 9, 2026

    fix(grep): follow symlinks by default in ripgrep searches

    This issue will close once commit 67a7c7f is merged into the 'dev' branch.
    67a7c7f
  4. kdcokenny
    changed the title [-]Grep Tool Fails on Symlinks—But Only When It Matters[/-] [+]Grep Tool Fails on Symlinks[/+] on Jan 9, 2026
  5. slockers37 commented on Jan 10, 2026

    @slockers37
    slockers37
    on Jan 10, 2026
    More actions

    This is pretty important for my workflow, and it’s honestly really annoying to deal with. It breaks my usual way of working, so I’d really appreciate a fix.

    Reacted by Kenny
  6. rekram1-node
    closed this as completedin #7501on Jan 10, 2026
  7. jeroenev commented on Feb 19, 2026

    @jeroenev
    jeroenev
    on Feb 19, 2026
    More actions

    This was broken again in #11415
    Maybe this issue should be re-opened?
    I've fixed this again in #12992 with an optional setting, so you can follow symlinks but it's not the default, since following symlinks can cause issues of it's own (recursive symlinks etc...)

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

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.