anomalyco / anomalyco/opencode
fs/list returns HTTP 500 for the project worktree root when serve is started in a non-git directory
@nexxeln is already working on this.
Since Aug 1, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
When opencode serve is started in a directory that is not a git repository, the web UI directory picker is completely broken: it shows "No folders found" and every directory-related action fails. The server-side cause is that fs/list returns HTTP 500 for / — which is the project worktree itself in this scenario.
I know Project.resolve returning worktree / for non-git dirs is working as designed (see #38992), so this issue is about the fs API failing on its own worktree, not about the worktree resolution.
Plugins
None.
OpenCode version
1.18.11
Steps to reproduce
-
Start the server in a non-git directory (e.g. a fresh VM home dir):
cd /root # NOT inside a git repository opencode serve --port 34192 --hostname 0.0.0.0 -
The project worktree resolves to
/:curl -u opencode:<password> http://127.0.0.1:34192/project/current # {"id":"global","worktree":"/", ...} -
Listing the worktree itself returns HTTP 500, even though
/contains 23 entries:curl -u opencode:<password> "http://127.0.0.1:34192/api/fs/list?path=/" # HTTP 500 # {"name":"UnknownError","data":{"message":"Unexpected server error. Check server logs for details.","ref":"err_..."}} -
Same 500 for any path outside the startup directory:
/tmp,/etc,/var. -
Starting inside a git repo works fine: worktree resolves to the repo path and
fs/listreturns 200.
Screenshot and/or share link
No share link available (headless server). Can attach screenshot of the web UI empty picker if needed.
Operating System
Ubuntu 24.04 (server) / Safari on iOS (web UI client)
Terminal
None — web UI only.
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.