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
core: continuing a V1-created session fails with UNIQUE constraint on event seq #52395
After upgrading from OpenCode 1.18.20 to 2.0.20, continuing a session that was created under V1 permanently fails: every event insert for that session hits UNIQUE constraint failed: event.aggregate_id, event.seq. The event_sequence row for the session is behind the actual max(seq) in the event table, so writes can never succeed and the session becomes write-dead (messages sent to it are not persisted).
V2 should resume the per-session event sequence for pre-existing (V1-created) sessions at max(seq) + 1, or re-sync event_sequence with the event table on startup, so V1 sessions can be continued.
Actual Behavior
V2 inserts events at sequence numbers that already exist for the aggregate, so every write fails. The session cannot accept new messages.
Observed for session ses_f1066f4c8ffeSqEdL7iA67Ujnf (created 2026-09-29 under 1.18.20, directory ~):
event_sequence row for that aggregate: seq = 558
event table for that aggregate: 624 rows, max(seq) = 678
Errors logged at 2026-09-30T00:16:36Z and 2026-09-30T00:21:58Z:
The 1.18.x V1 line already used the same SQLite DB, so this looks like V2 initializing/tracking the per-aggregate sequence independently of rows written by V1.
Workaround: do not continue V1-created sessions; start new ones.
Everything else works: the session list is intact (3,700+ sessions readable), only writes to affected sessions fail.
Activity
github-actions commentedon Sep 30, 2026
This issue doesn’t fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
UNIQUE constraint failed: event.aggregate_id, event.seq.If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Oct 1, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.