Skip to content

desktop: "Background service failed to start" on Windows after SQLiteError: disk I/O error at boot #59866

Closed as duplicate

Description

@4Hussam

Summary

On Windows, OpenCode Desktop 2.2.0 fails to start its local server: the bundled CLI (opencode serve --service) dies during boot with SQLiteError: disk I/O error. The renderer then shows the fatal screen "Something went wrong — An error occurred starting the local server." Restarting the app does not recover.

Environment

  • opencode version: 2.2.0 (Desktop, packaged; bundled opencode-cli 2.2.0; Electron 44.9.1 / Chrome 152.0.7977.167)
  • OS: Windows NT 10.0 (x64)
  • Terminal: Desktop app (no TUI involved)
  • Shell: PowerShell 5.1 (C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.EXE)
  • Install/channel: C:\Users\<user>\AppData\Local\Programs\@opencode-aidesktop, channel latest, updater reports up-to-date on 2.2.0
  • Active plugins: coucou.ts (local file), [email protected], @nick-vi/[email protected], @tarquinen/[email protected], [email protected] — three of these fail to load on every boot (see Additional Context)

Reproduction

  1. Install/launch OpenCode Desktop 2.2.0 on Windows 10/11 x64.
  2. The app starts the bundled CLI with args=["serve","--service"].
  3. Within ~500 ms the CLI logs background service boot failed cause="Cause([Die(SQLiteError: disk I/O error)])".
  4. All subsequent API calls fail: GET /api/info → 500, GET /api/event → 503.
  5. The renderer aborts with fatal renderer error: Desktop IPC handler failed ... cause: "Background service failed to start" and shows the error screen.
  6. Closing and relaunching the app does not help — the same failing service keeps answering 500.

Expected Behavior

The local background service boots, the database opens, and the desktop UI loads normally (as it did up to 2026-10-27 14:40 UTC on the same machine).

Actual Behavior

09:18:16.909  "cli starting" version=2.2.0 channel=latest local=false args="[\"serve\",\"--service\"]" role=cli
09:18:17.402  ERROR "background service boot failed" cause="Cause([Die(SQLiteError: disk I/O error)])" role=server
09:18:17.431  GET /api/info   500
09:18:17.734  GET /api/event  503
...            (30 min of 500/503 retries, then 401s)

Renderer side:

Error: Desktop IPC handler failed
    at oc://renderer/assets/main-*.js
Caused by:
{
  "name": "UnknownError",
  "message": "An error occurred in Effect.tryPromise",
  "cause": { "name": "Error", "message": "Background service failed to start" }
}

Additional Context

Timeline

  • 2026-10-27T12:06 — DB migrations ran successfully, including 20261025123711_blob and 20261025154125_drop_session_pending.
  • 2026-10-27T14:40 — last healthy run: /api/event returned 200, sessions working.
  • 2026-10-28T09:18:16 — first failing boot. No migration log line appears at all, so the failure happens at/before opening the SQLite DB, not during a migration.

Possible trigger — manual DB maintenance on 2026-10-02

The DB was cleaned up through the CLI from inside OpenCode itself, then the WAL/SHM files were removed with the app running:

opencode db "VACUUM INTO 'C:/Users/<user>/Documents/opencode-backup/opencode-backup-preclean.db'"
opencode db "ATTACH DATABASE '...opencode-backup-preclean.db' AS bak; ..."
Remove-Item -LiteralPath "C:\Users\<user>\.local\share\opencode\opencode.db-wal",
                        "C:\Users\<user>\.local\share\opencode\opencode.db-shm"

Data dir: C:\Users\<user>\.local\share\opencode (local disk, not OneDrive). Projects live under OneDrive, but the DB does not.

Secondary issue 1 — WSL sidecar fails on every launch

[wsl] spawning wsl sidecar { distro: 'PCMClawUbuntu' }
[wsl] wsl sidecar failed to start { message: 'WSL server exited before becoming healthy (code=1 signal=null)' }

The opencode binary installed inside that distro prints the serve help and exits 1, i.e. it is an older (v1) CLI that does not understand --service. This happens on all 7 runs present in the debug bundle.

Secondary issue 2 — plugins incompatible with the v2 plugin API

Three plugins fail on every boot (70/69/69 times respectively):

PluginModule.LoadError: Plugin must export a default definition with an id and an effect or setup function.

Targets: local ~/.config/opencode/plugins/coucou.ts, [email protected], @nick-vi/[email protected].

Other noise in the logs (probably unrelated)

  • spawn ENOMEM, spawn UNKNOWN (3×)
  • Cannot connect to API: getaddrinfo ENOTFOUND opencode.ai, net::ERR_NAME_NOT_RESOLVED
  • Failed to fetch models.dev (109×)
  • Updater: opencode-desktop-win-x64.exe.blockmap 404 and ERR_CONTENT_LENGTH_MISMATCH

Workaround attempted

None yet. Planned next step: fully quit the app, back up opencode.db, opencode.db-wal, opencode.db-shm, then PRAGMA wal_checkpoint(TRUNCATE) / remove the stale -wal and -shm files.

A full debug bundle (desktop + server logs, network.netlog) and a screenshot of the error screen are available on request / already attached to the internal report.

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report and timeline, @4Hussam!

    I think this is a duplicate of #59189. There, the Windows Desktop background service also fails at boot with SQLiteError: disk I/O error. The failed serve --service process then stays alive on the service port and answers 500 on /api/info and 503 on /api/event forever. Because of that, relaunching the app keeps showing Background service failed to start, as you saw. That issue has been reproduced on the current code.

    Possible duplicates and related issues, ordered from most to least likely:

    The workaround from #59189 should get you running again:

    1. Quit the app.
    2. End any leftover opencode-cli.exe process in Task Manager, or run opencode service stop with the bundled CLI.
    3. Reopen the app.

    If the disk I/O error comes back even after that process is gone, please reply here with the new log lines. That would point to a problem with the database itself (possibly related to the WAL/SHM files you removed), which would be a separate issue. Making a backup copy of opencode.db and its -wal/-shm files first, as you planned, is a good idea.

    Two side notes:

    • The WSL sidecar fails because the opencode inside that distro is a v1 CLI, which doesn't understand --service. Upgrading it there to v2 (@opencode/cli) should fix that.
    • The three plugin load errors happen because those plugins use the v1 plugin format. They need v2-compatible versions.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    We haven't heard back, so I'm closing this as a duplicate of #59189. In that issue, a background service whose boot fails with SQLiteError: disk I/O error stays alive on the service port. It keeps answering 500/503, so Desktop shows Background service failed to start on every relaunch. Please follow #59189 for updates. The open PRs #55311 and #57134 address it.

    Until it's fixed, you can work around it: quit the app, end any leftover opencode-cli.exe process (or run opencode service stop), then reopen the app.

    If the disk I/O error still comes back once that process is gone, please comment here with the new log lines and we can reopen this as a separate database issue. Thanks for the thorough report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions