You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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:
packages/opencode/src/tool/grep.ts — the CLI args
packages/opencode/src/file/ripgrep.ts — the Ripgrep.search args
That should make all the file-finding tools behave consistently across symlinked directories.
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.
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...)
Activity
github-actions commentedon Jan 9, 2026
This issue might be a duplicate of or related to existing issues. Please check:
Feel free to ignore if none of these address your specific case.
fix(grep): follow symlinks by default in ripgrep searches
[-]Grep Tool Fails on Symlinks—But Only When It Matters[/-][+]Grep Tool Fails on Symlinks[/+]slockers37 commentedon Jan 10, 2026
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.
jeroenev commentedon Feb 19, 2026
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...)