grep tool silently returns empty results when the search path does not exist
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start at the grep tool's handling of FSUtil.find and the realpath call for the configured path. Compare how read and glob report missing targets, then make a missing file or directory produce a clear ToolFailure instead of an empty result set and verify the returned error and result behavior.
Written by the indexing model from the issue text.
Description
Summary
The grep tool silently returns an empty result set when the configured path (directory or file) does not exist, instead of reporting an error. This masks typos and misconfigured working directories: a user searching path: "src/utlis" (sic) gets zero matches with no indication that the path is wrong, and may conclude the codebase has no hits.
Expected
When the search path cannot be resolved, grep should fail with a clear ToolFailure (e.g. "path does not exist: ") so the agent can correct the argument, matching the behavior of read/glob when their targets are missing.
Actual
Grep tool returns { content: { files: [], numFiles: 0, content: "" } } for a non-existent path. The underlying FSUtil.find/realpath call degrades to an empty result, and the error is swallowed.
Environment
- opencode version: dev
- grep invoked with
pattern+pathpointing at a missing directory/file
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 20m
- Merged PRs (30d)
- 358
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from anomalyco/opencode
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
[FEATURE]: Bump gitlab-ai-provider to 6.15.1 on v2 (Fable 5.1, GPT-6 Astra, workflow reconnect fix) Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
All issues in anomalyco/opencode
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100