Skip to content

[Bug]: v1.17.10 Bun segfault + downgrade to v1.17.9 breaks SQLite schema (missing replacement_seq column) #33773

Closed as duplicate

Description

@hyxieshi

Description

Two related issues occur when running OpenCode on Windows:
Issue 1: v1.17.10 Bun Segmentation Fault
OpenCode v1.17.10 crashes due to a segmentation fault from the embedded Bun v1.3.14 runtime.
Crash Log:
plaintext
Bun v1.3.14 (0d9b296a) Windows x64 (baseline)
Windows v.win11_dt
CPU: sse42 avx avx2 avx512

panic(main thread): Segmentation fault at address 0x1C4D851CAA2
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
Runtime memory metrics at crash time: RSS 1.17GB / Peak 1.18GB / Commit 1.73GB / Faults 558638.

Image

Issue 2: SQLite Schema Incompatibility After Downgrading to v1.17.9
After downgrading from v1.17.10 to v1.17.9 to bypass the Bun crash, a runtime SQLite error blocks startup:
plaintext
SQLiteError: no such column: replacement_seq
at prepare (bun:sqlite:345:37)
at SessionContextEpoch.requestReplacement
at SessionPrompt.createUserMessage
at SessionPrompt.prompt
at SessionHttpApi.prompt
Root Cause Analysis
v1.17.10 introduced a schema migration that added the replacement_seq column to the session_context_epoch table. Once the database is upgraded by v1.17.10, downgrading to v1.17.9 does not trigger any rollback migration. The older version’s code still attempts to query this newly added column in certain code paths, resulting in a missing column error.

Image

Plugins

No response

OpenCode version

1.17.10

Steps to reproduce

1./compact
2./sessions

Screenshot and/or share link

No response

Operating System

win11

Terminal

No response

Activity

  1. github-actions commented on Jun 25, 2026

    @github-actions
    Contributor

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

    The SQLite schema incompatibility after downgrade (replacement_seq column missing) appears to be a separate/new issue not previously reported.

  2. Simon7612 commented on Jun 25, 2026

    @Simon7612

    I encountered the same problem and have already reported it to BUN

  3. BrunoEdPerezS commented on Jun 25, 2026

    @BrunoEdPerezS

    For now, I downgraded to 1.17.9. OpenCode insisted on autoupdating, so I disabled it. However, I still encountered the same SQL error.
    I managed to fix it by deleting the .db files in the %USER%.local\share\opencode directory. I lost my session history, but OpenCode is working again.

  4. hyxieshi commented on Jun 25, 2026

    @hyxieshi
    Author

    The desktop version of OpenCode can be downloaded to retain chat records.

    Image
  5. g98051815 commented on Jun 25, 2026

    @g98051815

    Found a mistake in the issue description.

    It says v1.17.10 added the replacement_seq column. It is the opposite — the migration removes it.

    PR #33378 (the simplify refactor in v1.17.10) did three things together:

    1. Added a migration: DROP COLUMN replacement_seq
    2. Removed the column from the runtime schema
    3. Removed the requestReplacement function entirely

    So v1.17.10 is consistent with itself — the column is gone, and the code does not need it. No error on v1.17.10 alone.

    The error only happens when old code meets the new schema. Two ways that can happen:

    1. You downgrade — upgraded to 1.17.10, migration ran (column dropped), then went back to 1.17.9. Old requestReplacement still reads replacement_seq, column does not exist anymore. This is what the issue describes.

    2. Stale process — e.g. an opencode serve daemon from before the upgrade is still running with old code. The new TUI sends prompt_async requests to it over HTTP. The daemon runs the old code, hits the deleted column, and fails. The error shows up in your TUI because it is the HTTP response coming back. This is what I ran into.

  6. Simon7612 commented on Jun 25, 2026

    @Simon7612

    I use SCOOP to manage OpenCode, and after downgrading to 1.17.9 via SCOOP, I haven't encountered SQLite errors

  7. simonklee commented on Jun 25, 2026

    @simonklee
    Member

    We'll cut a release which should allow you to upgrade.

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