You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Data loss: update recreated ~/.local/share/opencode and did not migrate legacy sessions #34445
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
UI changed after an update (new storage layout).
All contents of ~/.local/share/opencode were timestamped to the moment of the update (no older files remained).
New opencode.db contained only the single session created post-update.
No legacy storage/session/*.json directory existed anywhere on disk.
Logs contained no record of a data-migration/import step.
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
github-actions commentedon Jun 29, 2026
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.
github-actions commentedon Aug 29, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.