Repository navigation
Open
Labels
Description
Summary
On Windows, resuming from sleep can make the background service boot fail with SQLiteError: disk I/O error. The failed process keeps running and holds the service port, answering 500 on /api/info and 503 on /api/event indefinitely, so OpenCode Desktop cannot start a healthy service and shows Background service failed to start until the stale process is killed manually. The database itself is intact.
Environment
- opencode version: 2.1.4 (OpenCode Desktop, bundled
opencode-cli.exe2.1.4-x64) - OS: Windows 11 Pro 10.0.26200 (build 26200); WSL2 kernel 6.18.40.1-microsoft-standard-WSL2 (the WSL CLI 2.0.32 was unaffected)
- Terminal: OpenCode Desktop (no TTY); PowerShell for CLI checks
- Shell: PowerShell
- Install/channel: Desktop installer
OpenCode 2.1.4, latest channel; bundled CLI staged at%APPDATA%\ai.opencode.desktop\cli\2.1.4-x64\opencode-cli.exe - Active plugins: local plugin
local-permission-sound(%USERPROFILE%\.config\opencode\plugins\local-permission-sound); MCP serverobsidian
Reproduction
- Run OpenCode Desktop with the managed background service active.
- Put Windows to sleep, then resume a few hours later.
- The client starts
serve --service~41 s after wake; the boot fails ~7 s after that. - Reopen or retry the desktop app:
Desktop IPC handler failed ... Background service failed to start. - The stale process keeps
GET /api/infoat500(and/api/eventat503) indefinitely.
Expected Behavior
After resume, the service should open SQLite successfully (or retry), report healthy on /api/info, and Desktop should reconnect without manual cleanup.
Actual Behavior
Service log (UTC):
timestamp=2026-10-26T03:14:18.333Z level=INFO run=387fa9fe message="cli starting" version=2.1.4 channel=latest local=false args="[\"serve\",\"--service\"]" role=cli
timestamp=2026-10-26T03:14:25.125Z level=ERROR run=16aa2b94 message="background service boot failed" cause="Cause([Die(SQLiteError: disk I/O error)])" role=server
timestamp=2026-10-26T03:14:25.132Z level=INFO run=16aa2b94 message="Sent HTTP response" http.span=3 role=server http.method=GET http.url=/api/info http.status=500
...
timestamp=2026-10-26T05:48:05.047Z level=INFO run=16aa2b94 message="Sent HTTP response" http.span=0 role=server http.method=GET http.url=/api/info http.status=500
Desktop renderer log:
[2026-10-26 07:48:05.577] [error] (renderer) fatal renderer error {
error: 'Error: Desktop IPC handler failed\n' +
... "Background service failed to start" ...
The process that failed at boot stays alive, owns port 44000, and never recovers.
Additional Context
PRAGMA quick_checkandPRAGMA integrity_checkon a copy ofopencode.db(31.7 MB) plus its-wal(10.7 MB) returnedok; the database opened read/write in WAL mode and all 20 tables were readable.- 8.8 GB free on
C:; no disk/NTFS errors in the System event log; the DB directory is a normal directory owned by the user with Full Control; no reparse point. - Wake event: Power-Troubleshooter event 1 at 2026-10-26 05:13:37 local time (asleep since 2026-10-25 20:44:43). The failing service start was 41 s later.
- Seen once so far, not reproducible on demand; earlier boots on the same database succeeded. Real-time antivirus protection was enabled at the time.
- Workaround that worked: stop the stale process (port 44000 became free), start the service again;
/api/infothen returned200with{"version":"2.1.4","pid":...,"urls":["http://127.0.0.1:44000", ...]}and no further boot failures. - Related: Starting background server... Error: Background service failed to start #57032 (stale service prevents restart), Error: Unexpected error disk I/O error #32571 (disk I/O error, older version).
Activity
opencode-agent commentedon Oct 26, 2026
Thanks for the detailed report and logs. I could reproduce this with the 2.1.4 CLI on Linux. I didn't test the desktop app or Windows, but the CLI uses the same background service code as Desktop.
Steps, simulating the boot-time SQLite failure:
opencode.dbunreadable (I overwrote it with random bytes).opencode service startfails withBackground service failed to start, and the log showsbackground service boot failedwithSQLiteError: file is not a database. The failedserve --serviceprocess stays running on the service port.Background service failed to start, andopencode service statusreportsstoppedwhile the failed process is still alive. Only killing that process recovers, which matches your workaround.This still happens on the latest
dev(ed74ec8). The script below reproduces it.Related:
disk I/O error. It was closed, but this behaviour is still there.Until this is fixed, ending the leftover
opencode-cli.exeprocess (or runningopencode service stop) and reopening the app is the workaround.Reproduction script (repro.sh)
Run it:
bash repro.sh