Skip to content

fix(tool): correct misleading "No files found" message in grep tool#15861

Open
saurav61091 wants to merge 3 commits intoanomalyco:devfrom
saurav61091:fix/grep-no-matches-message
Open

fix(tool): correct misleading "No files found" message in grep tool#15861
saurav61091 wants to merge 3 commits intoanomalyco:devfrom
saurav61091:fix/grep-no-matches-message

Conversation

@saurav61091
Copy link

Issue for this PR

Closes #15860

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The grep tool searches for regex pattern matches within files using ripgrep. When no matches are found, it returned "No files found" which is misleading — it implies the file search failed, not that the pattern had zero matches.

Changed the message to "No matches found" on both code paths (ripgrep exit code 1 on line 70, and empty parsed results on line 114). This is consistent with the success message on line 119 which says "Found N matches".

How did you verify your code works?

  • bun run build passes
  • Reviewed the two affected lines in packages/opencode/src/tool/grep.ts
  • The change is a simple string replacement with no logic changes

Screenshots / recordings

N/A — no UI changes, only tool output text.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

saurav61091 and others added 3 commits March 3, 2026 20:47
The grep tool searches for pattern matches within files, but displayed
"No files found" when no matches were found. This is misleading since
it implies a file search failure rather than zero pattern matches.
Changed to "No matches found" for consistency with the success message
which says "Found N matches".
Update the test assertion to match the corrected output message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: grep tool displays misleading "No files found" instead of "No matches found"

1 participant