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
JSON->SQLite one-time migration reruns on channel-specific DBs #16885
The JSON->SQLite startup migration can rerun on every launch for non-latest channels (for example local/dev builds).
Reproduction
Run OpenCode on a non-latest channel where the DB path is channel-specific (for example opencode-local.db)
Keep legacy JSON storage files under ~/.local/share/opencode/storage/
Start opencode twice
Actual
The startup banner "Performing one time database migration" appears on every launch and rescans/reimports JSON storage each time.
Expected
Migration should run once and skip on subsequent launches.
Root cause
The startup gate checks for ~/.local/share/opencode/opencode.db, but non-latest channels can use DB names like opencode-local.db, so the gate never flips to true.
Why not just check channel-specific DB names?
Checking channel DB filenames only addresses the rerun failure mode. It does not address the existing skip failure mode where a DB file can exist from prior schema migrations even if JSON->SQLite import has never completed. In that case, a DB-existence gate can incorrectly skip migration and orphan legacy JSON data.
Suggested fix
Use a dedicated migration completion marker (or migration table entry) instead of checking for a specific DB filename.
Reacted by Nikita Rudenko, Michael Barney, Jr, Blake Hamm, Andre, Fahim Ali Zain, eberkut, David Isaksson, l1onsun and Charles
This issue might be a duplicate of existing issues. Please check:
JSON→SQLite session migration silently skips for incremental upgrades #13654: Same root cause — the opencode.db existence check is an unreliable migration gate — and the same suggested fix (dedicated migration marker). That issue covers the incremental-upgrade case; this one covers the channel-specific DB name case. They may be best addressed together.
I experienced precisely this issue, with my file being named opencode-stable.db. My workaround was to use a symlink: ln -s ~/.local/share/opencode/opencode-stable.db ~/.local/share/opencode/opencode.db
Reacted by Maarten Dirkse, Nikita Rudenko, Spencer Brower, Arthur Outhenin-Chalandre, Hien Pham .D, Felix Rath, ldlac, Fahim Ali Zain, Aashish Sharma, David Isaksson and 2 more
Reacted by Spencer Brower, Alexander Stage, Felix Rath, Blake Hamm and Fahim Ali Zain
for me is ln -s ~/.local/share/opencode/opencode-local.db ~/.local/share/opencode/opencode.db
pls check what is under ~/.local/share/opencode/ before u do it
I experienced precisely this issue, with my file being named opencode-stable.db. My workaround was to use a symlink: ln -s ~/.local/share/opencode/opencode-stable.db ~/.local/share/opencode/opencode.db
Activity
github-actions commentedon Mar 10, 2026
This issue might be a duplicate of existing issues. Please check:
opencode.dbexistence check is an unreliable migration gate — and the same suggested fix (dedicated migration marker). That issue covers the incremental-upgrade case; this one covers the channel-specific DB name case. They may be best addressed together.alteredoxide commentedon Mar 16, 2026
I experienced precisely this issue, with my file being named
opencode-stable.db. My workaround was to use a symlink:ln -s ~/.local/share/opencode/opencode-stable.db ~/.local/share/opencode/opencode.dbopencode: add patch for anomalyco/opencode#16885
bew commentedon Apr 5, 2026
note: I've opened #21056 with an alternate fix (compared to #16884) that use the real DB path as the marker path.
xiantang commentedon Apr 5, 2026
for me is
ln -s ~/.local/share/opencode/opencode-local.db ~/.local/share/opencode/opencode.dbpls check what is under ~/.local/share/opencode/ before u do it
kirelagin commentedon Apr 25, 2026
This is also a problem when building from the flake in the upstream repository (i.e. this one), since it sets channel to
local.fix(opencode): use OPENCODE_CONFIG + workaround DB migration marker
0fflineuser commentedon May 31, 2026
I also got the issue with one NixOS after upgrading from 25.11 to 26.05.
bew commentedon May 31, 2026
Doesn't surprise me since my PR isn't merged yet 😬
See #21056
bew commentedon Jun 13, 2026
Hello everyone!
In #30461 the json migration system was removed (first released in v1.16.0).
👉 So this issue can be closed ¯\_(ツ)_/¯
refactor(ai): remove fixed W/A for opencode
refactor(ai): remove fixed W/A for opencode
refactor(ai): remove fixed W/A for opencode
github-actions commentedon Aug 12, 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.