anomalyco / anomalyco/opencode
TUI logs 'Failed to read KV state' ENOENT error on fresh install
Open
@simonklee is already working on this.
Since Aug 21, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
On a device where ~/.local/state/opencode/kv.json does not exist yet, opening the console (ctrl+p → toggle console) logs an error:
[ERROR] 'Failed to read KV state' {
error: Error {
code: 'ENOENT',
path: '/home/<user>/.local/state/opencode/kv.json',
syscall: 'open',
errno: -2
}
}
A missing kv.json is expected on first run — KV should start from empty state instead of logging an error. The file gets created lazily on first write.
Plugins
None
OpenCode version
1.18.21
Steps to reproduce
- Ensure ~/.local/state/opencode/kv.json does not exist
- Launch opencode TUI
- ctrl+p → toggle console
- Observe 'Failed to read KV state' ENOENT error in output
Operating System
Linux
Terminal
Windows Terminal (WSL)
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.