Skip to content

Running opencode locally and in docker while sharing config corrupts the database #14194

@d4rky-pl

Description

@d4rky-pl

Description

If you run opencode locally and in docker and share ~/.local/share/opencode/, ~/.local/state/opencode/ and ~/.config/opencode/ with the container it will lead to sqlite corruption if you try to run two sessions at the same time:

    588 |           session_id: sessionID,
589 |           time_created,
590 |           data, GitHub Copilot
591 |         })▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
592 |         .onConflictDoUpdate({ target: MessageTable.id, set: { data } })                                                                                                                                    ctrl+t variants  tab agents  ctrl+p commands
593 |         .run()
               ^
SQLiteError: database disk image is malformed
      errno: 11,
 byteOffset: -1,
       code: "SQLITE_CORRUPT"

      at #run (bun:sqlite:185:20)
      at <anonymous> (src/session/index.ts:593:10)
      at run (node:async_hooks:62:22)
      at use (src/storage/db.ts:111:28)
      at <anonymous> (src/session/index.ts:584:14)
      at process (src/session/processor.ts:411:25)

Plugins

No response

OpenCode version

No response

Steps to reproduce

  1. Run opencode session locally
  2. Run another opencode session in Docker container with
  -v "$HOME/.local/state/opencode:/home/node/.local/state/opencode" \
  -v "$HOME/.local/share/opencode:/home/node/.local/share/opencode" \
  -v "$HOME/.config/opencode:/home/node/.config/opencode" \
  1. Start agent session (e.g. ask it to review the codebase)

Screenshot and/or share link

It crashes immediately when the next session starts
https://opncd.ai/share/fbRFgNq0

Operating System

macOS 15.7.4

Terminal

iTerm

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions