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
[sqlite] duplicate column name: cost migration error when upgrading from v1.14.41 to v1.17.11 #34584
I upgraded OpenCode from v1.14.41 to v1.17.11. Upon starting the container (using opencode serve --port 4096 --hostname 0.0.0.0), the application crashes during startup with the following error:
Previously had OpenCode v1.14.41 running with persisted data (likely in a mounted volume, e.g., ~/.local/share/opencode).
Upgraded the container image to v1.17.11.
Restarted the container with the same persistent data volume.
The startup process attempts to perform a schema migration and fails with duplicate column name: cost.
Expected behavior
The migration should handle existing columns gracefully (e.g., check if column exists before adding) and complete successfully, preserving all historical data. The server should start normally.
Actual behavior
The migration fails, and the server exits with an error, preventing startup.
Possible Cause
The migration script tries to ALTER TABLE ADD COLUMN cost on a table that already contains a cost column. This can happen if:
The database schema from v1.14.41 already had a cost column, but the migration logic in v1.17.11 does not check for its existence before adding.
The migration is re‑executed on an already partially migrated database.
Workaround Attempted
I temporarily resolved this by deleting the database files (~/.local/share/opencode/opencode.db*) and letting the server recreate them, but this loses all historical session data. I would prefer a solution that preserves my data.
Environment
Deployment: Docker container
OpenCode Version (upgraded): v1.17.11
OpenCode Version (previous): v1.14.41
Persistent data path:/root/.local/share/opencode/ (or custom mount) – the database is SQLite.
Activity
github-actions commentedon Aug 30, 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.