anomalyco / anomalyco/opencode
`@` file search returns nothing when cwd is the home directory — fff init failure leaves an empty stub, no ripgrep fallback
@kitlangton is already working on this.
Since Aug 9, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
When the working directory is the user's home directory (or filesystem root), file search returns zero results for the entire session — the @ autocomplete shows no files/directories, and /api/fs/find returns [] for every query.
fff refuses to initialize there (log: failed to initialize fff: Can not run certain FFF features in a file system root or home directories). That's reasonable, but packages/core/src/filesystem/search.ts handles the failure by installing a permanently empty stub:
if (!result?.ok) {
...
return Service.of({
find: () => Effect.succeed([]),
glob: () => Effect.succeed([]),
grep: () => Effect.succeed([]),
})
}
instead of falling back to ripgrepLayer. The layer is chosen by Flag.OPENCODE_DISABLE_FFF || !Fff.available(), and available()\) is true even when create()` will fail for this directory — so the failure is silent and unrecoverable without the env var.
OpenCode version
1.18.15
Steps to reproduce
cd ~ && opencode serve --hostname 127.0.0.1 --port 4096 &curl 'http://127.0.0.1:4096/api/fs/find?query=projects&limit=20'→{"data":[]}(also empty forquery=andtype=directory)- Restart with
OPENCODE_DISABLE_FFF=1→ the same query correctly returns matching files and directories.
Expected behavior
When Fff.create() fails, fall back to the ripgrep search layer (or select the layer based on whether the directory is indexable) instead of returning empty results forever.
Note on the ripgrep fallback
Once the fallback kicks in, empty queries still return [] because it uses fuzzysort 3.1.0, where go('', items) yields nothing (fff returns all entries for an empty query, so the two layers disagree). Worth normalizing too.
Operating System
Linux (WSL2)
Terminal
Windows Terminal / bash
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.
Assessment
This issue has not been assessed yet.