Skip to content

Data loss: update recreated ~/.local/share/opencode and did not migrate legacy sessions #34445

Closed as not planned

Description

@lisaleezer85

Data loss: update recreated ~/.local/share/opencode and did not migrate legacy sessions

Summary

After an OpenCode update (storage moved to a SQLite database, opencode.db), the entire ~/.local/share/opencode data directory was recreated and all previously saved session history was lost. The legacy JSON storage/ directory no longer exists and was not imported into the new database.

Environment

  • OS: macOS (Apple Silicon, arm64)
  • Storage format observed: SQLite (opencode.db, -wal, -shm)
  • Date of incident: 2026-06-29

What happened

  1. UI changed after an update (new storage layout).
  2. All contents of ~/.local/share/opencode were timestamped to the moment of the update (no older files remained).
  3. New opencode.db contained only the single session created post-update.
  4. No legacy storage/session/*.json directory existed anywhere on disk.
  5. Logs contained no record of a data-migration/import step.
  6. Config (~/.config/opencode/opencode.json), plugins, and skills were untouched — only session history under ~/.local/share/opencode was lost.

Expected behavior

The update/migration should import existing JSON sessions into the new SQLite database, or preserve the legacy storage/ directory, rather than recreating the data directory and discarding prior session history.

Impact

Irrecoverable loss of prior conversation/session history for users without an independent backup (no Time Machine / snapshots).

Suggested fixes

  • Detect and migrate legacy storage/ data into opencode.db on first run of the new version.
  • If migration is not possible, move (not delete) the legacy directory to a *.bak path and log it.
  • Emit an explicit log line documenting the migration outcome.

Activity

  1. github-actions commented on Jun 29, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct (e.g. the data directory was fully recreated/deleted rather than just inaccessible), please clarify that in your report.

  2. github-actions commented on Aug 29, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions