Skip to content

OpenCode 2.4.0 fails to update session messages on macOS Monterey – SQLite syntax error #65764

Closed

Description

@ZackTechLtd

Description

Environment

OpenCode: 2.4.0 (installed through npm)

Previous version: 2.3.2

macOS: Monterey 12.7.6

Mac: 2017 Intel MacBook Air

Node.js: v24.20.0

System SQLite: 3.37.0

Homebrew/other SQLite: 3.53.4

Description

After upgrading OpenCode from 2.3.2 to 2.4.0, session processing fails with repeated Failed to drain Session errors.

The failure occurs when OpenCode attempts to update the session_message table.

Error

EffectDrizzleQueryError: Failed query:
update "session_message"
set "time_updated" = ?,
"data" = json_set(
?,
'$.content',
json(coalesce(
"session_message"."data" -> '$.content',
'[]'
))
)
where (
("session_message"."id" = ?)
and ("session_message"."session_id" = ?)
)

SQLiteError: near ">": syntax error

Additional diagnostics

The system SQLite reports:

/usr/bin/sqlite3 --version

3.37.0

The SQLite executable available through my PATH reports:

sqlite3 --version

3.53.4

The JSON extraction operator works with the latter but is not supported by SQLite 3.37.0.

Steps to reproduce

Run OpenCode 2.4.0 on macOS Monterey 12.7.6.

Open an existing session or start a new session.

Allow OpenCode to process and persist messages.

Observe repeated Failed to drain Session errors in the OpenCode log.

Expected behaviour

OpenCode should successfully persist session messages on supported macOS versions.

Actual behaviour

Session persistence fails with a SQLite syntax error near > when executing a query containing the JSON -> operator.

Question

Could OpenCode 2.4.0 be using Apple's system SQLite (3.37.0) rather than a sufficiently recent SQLite library?

If so, could the SQLite dependency/runtime compatibility be addressed, or could the query be made compatible with the SQLite version supplied by macOS Monterey?

I have temporarily rolled back to OpenCode 2.3.2 to continue working.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot

No response

Operating System

No response

Terminal

No response

Activity

  1. added
    area/sessions-storage
    type/bug
    version/v2
    on Nov 23, 2026
  2. opencodejr commented on Nov 23, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report and the SQLite diagnostics, they help a lot.

    I couldn't reproduce this here. My sandbox runs Linux, and the Linux build of OpenCode 2.4.0 has its own SQLite (3.53.4) built in, which supports the -> operator, so the query can't fail there. Testing it properly needs the older SQLite you have on macOS Monterey, so a maintainer with that setup will need to confirm it.

    The query from your error (... -> '$.content' ...) is still in the latest dev code (7cfd868), so nothing suggests this has been fixed yet. Rolling back to 2.3.2, as you did, is a sensible workaround for now.

  3. Hona commented on Nov 23, 2026

    @Hona
    Member

    Thanks for the report, your diagnosis was right. On macOS, OpenCode uses the system SQLite rather than a bundled one, and 2.4.0 started using the -> JSON operator on its default write path. That operator needs SQLite 3.38, and macOS 12 ships 3.37.

    The fix is in #65771 and ships in the next release.

    Workaround on 2.4.0. Add this to your OpenCode config (for example ~/.config/opencode/opencode.jsonc) and restart OpenCode:

    {
      "experimental": {
        "part_rows": false
      }
    }

    This switches message saving back to the 2.3.2 write path, which doesn't use ->.

    It doesn't cover every case: a session can still hit the same error when a request that was being retried is interrupted. If you see "Failed to drain Session" again with the setting on, staying on 2.3.2 until the fix is released is the safe choice.

  4. ZackTechLtd commented on Nov 23, 2026

    @ZackTechLtd
    Author

    Thank you for fixing the issue so promptly. Opencode is a great product, keep up the good work.

  5. ZackTechLtd commented on Nov 23, 2026

    @ZackTechLtd
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/sessions-storageplatform/macostype/bugversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions