anomalyco / anomalyco/opencode

TUI logs 'Failed to read KV state' ENOENT error on fresh install

Open
#43,916 3 comments 2 reactions 1 assignee View on GitHub

@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
  1. Ensure ~/.local/state/opencode/kv.json does not exist
  2. Launch opencode TUI
  3. ctrl+p → toggle console
  4. Observe 'Failed to read KV state' ENOENT error in output
Operating System

Linux

Terminal

Windows Terminal (WSL)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.