Skip to content

[Bug]: sqlite-vec fails to load on Node 22 Linux x64 (Vector store: unknown, distinct from #64776 and #65033) #88615

Closed

Description

@Joelincn

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

On Ubuntu 24.04 with Node v22.22.2, the sqlite-vec extension fails to load during gateway runtime, resulting in "Vector store: unknown" and memory_search returning 0 hits.

Steps to reproduce

  1. Install OpenClaw 2026.5.28 on Ubuntu 24.04.4 LTS (Proxmox VM) with Node.js v22.22.2
  2. Configure memorySearch with any embedding provider (e.g., DashScope text-embedding-v4)
  3. Run openclaw memory status → "Vector store: unknown"
  4. Memory index completes (645 chunks), but memory_search returns 0 hits

Expected behavior

The sqlite-vec extension loads successfully during gateway runtime, "Vector store" shows "sqlite-vec" as the vector backend, and memory_search returns vector similarity results matching the stored embeddings.

Actual behavior

"Vector store: unknown" for all agents despite sqlite-vec v0.1.9 (linux-x64 vec0.so) present. memory_search returns 0 hits. vec0.so binary is valid (ldd passes). Setting store.vector.extensionPath does NOT fix the issue.

OpenClaw version

OpenClaw version: 2026.5.28 (e932160)

Operating system

Ubuntu 24.04.4 LTS, Linux 7.0.2-7-pve, x86_64

Install method

npm global

Model

Qwen3.6-27B

Provider / routing chain

Default config → dashscope (Alibaba/text-embedding-v4) via dashscope.aliyuncs.com Note: embedding API works fine (DashScope returns vectors); the failure is in local sqlite-vec extension loading

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Key diagnostic: vec0.so loads fine in Node 22's node:sqlite manually:
  const { DatabaseSync } = require('node:sqlite');
  const db = new DatabaseSync(':memory:', { allowExtension: true });
  db.loadExtension('/path/to/vec0.so'); // WORKS ✅

Root cause appears in loadSqliteVecExtension() ESM import fallback chain in bundled runtime.
This is NOT the same as #64776 (macOS, CLI worked) or #65033 (Node 24 specific).

Impact and severity

No response

Additional information

No response

Activity

  1. clawsweeper commented on May 31, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed May 31, 2026, 8:41 AM ET / 12:41 UTC.

    Summary
    Keep open: current main still routes built-in memory through the same sqlite-vec loader surface, and I found no merged fix or shipped release that resolves the reported Node 22 Linux x64 failure. The exact failure mode needs a live Ubuntu/Node 22 repro because ordinary memory status can show unknown until a deep vector probe runs.

    Reproducibility: no. high-confidence current-main repro yet. The report has concrete Ubuntu/Node 22 steps and current source still has the implicated loader path, but I did not run that live environment and plain memory status can show unknown until --deep probes the vector store.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.

    Next step
    Needs maintainer or live-repro review before a repair lane because the likely root cause is not yet separated from adjacent sqlite-vec Linux, dependency ABI, provider, and status-probe failure modes.

    Review details

    Best possible solution:

    Confirm the Ubuntu Node 22 packaged-runtime failure with memory status --deep and a gateway memory_search, then fix the memory-host-sdk sqlite-vec load or packaging path with focused regression coverage and clear diagnostics.

    Do we have a high-confidence way to reproduce the issue?

    No high-confidence current-main repro yet. The report has concrete Ubuntu/Node 22 steps and current source still has the implicated loader path, but I did not run that live environment and plain memory status can show unknown until --deep probes the vector store.

    Is this the best way to solve the issue?

    Unclear. A memory-host-sdk sqlite-vec loader or package-resolution fix is plausible, but the safest path is to first capture the actual load error and distinguish import fallback, platform package, ABI, and provider/status-probe causes.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    Codex review notes: model gpt-5.5, reasoning high; reviewed against fd88f34a8fb7.

    Label changes

    Label changes:

    • add P2: This is a normal-priority memory vector recall bug with limited blast radius: semantic memory search degrades, but the core runtime is not reported unusable.
    • add impact:session-state: The reported failure affects indexed memory/vector recall state and can make agent memory searches return no semantic hits.
    • add issue-rating: 🦐 gold shrimp: Current issue advisory state selects this label.
    • add clawsweeper:needs-info: Current issue advisory state selects this label.
    • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.
    • add clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.

    Label justifications:

    • P2: This is a normal-priority memory vector recall bug with limited blast radius: semantic memory search degrades, but the core runtime is not reported unusable.
    • impact:session-state: The reported failure affects indexed memory/vector recall state and can make agent memory searches return no semantic hits.
    Evidence reviewed

    Acceptance criteria:

    • Reproduce on Ubuntu 24.04 x64 with Node v22.22.2 and OpenClaw current main or the packaged release under test.
    • Run openclaw memory status --deep --agent <agent> and record Vector store, Vector error, Embeddings, and Semantic vectors with private paths/secrets redacted.
    • Run openclaw memory index --force --agent <agent> and a gateway memory_search query against known indexed text to prove before/after behavior.
    • For a source fix, run node scripts/run-vitest.mjs packages/memory-host-sdk/src/host/sqlite-vec.test.ts extensions/memory-core/src/memory/manager-search.test.ts or a narrower equivalent focused on the changed files.

    What I checked:

    Likely related people:

    • steipete: Peter Steinberger moved the memory engine into the memory plugin and memory host SDK package, which introduced the current loader ownership boundary. (role: feature-history owner; confidence: high; commits: cad83db8b2f7, eebce9e9c7cb, e93216080aa1; files: extensions/memory-core/src/memory/manager-sync-ops.ts, packages/memory-host-sdk/src/host/sqlite-vec.ts, packages/memory-host-sdk/src/host/sqlite-vec-platform-variant.ts)
    • tanshanshan: Current blame for the loader and status lines points to a recent object-shorthand lint commit, which appears mechanical rather than the original behavior design. (role: recent line owner; confidence: medium; commits: 425a4ab2f2b8; files: packages/memory-host-sdk/src/host/sqlite-vec.ts, extensions/memory-core/src/memory/manager-sync-ops.ts, extensions/memory-core/src/cli.runtime.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. added
    P2Normal backlog priority with limited blast radius.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    on May 31, 2026
  3. Joelincn commented on Jun 2, 2026

    @Joelincn
    Author

    Update: SQLite ABI version mismatch confirmed

    After further investigation, I found the root cause:

    System SQLite version (via node:sqlite): 3.51.2 (Node v22.22.2)
    sqlite-vec precompiled binary: 0.1.9 (compiled for SQLite 3.45.x)

    Key findings

    1. The vec0.so binary loads correctly when tested manually with node:sqlite:

      • SQLite version (node:sqlite, Node v22.22.2): 3.51.2
      • vec0.so loaded: OK
      • vec_version(): v0.1.9
    2. However, OpenClaw's own loadSqliteVecExtension() in the bundled ESM runtime fails to load it during initial startup, resulting in "Vector store: unknown".

    3. This issue is related to the better-sqlite3 ABI mismatch ([Bug] Memory vector search broken in v4.11 — sqlite-vec loads but registers no functions (SQLite ABI mismatch) #65156) but in a DIFFERENT failure mode. Here, OpenClaw uses node:sqlite (not better-sqlite3), and the precompiled vec0.so (SQLite 3.45.x ABI) is incompatible with Node 22's built-in SQLite 3.51.2.

    4. memory status --deep before the fix showed:

      • Vector store: unknown
      • Vector dims: 1024
      • Vector path: .../sqlite-vec-linux-x64/vec0.so

    Current status: PARTIALLY RESOLVED ✅

    After running openclaw update (from 2026.5.27 to 2026.5.28) and a subsequent gateway restart, the issue appears to have resolved itself:

    • Before: Vector store: unknown → 0 hits in memory_search
    • Now: Vector store: ready → memory_search returns proper results (6 hits with vectorScore)

    It seems that a later restart eventually succeeded where earlier ones failed. This suggests the issue is a startup timing or retry race condition.

    Root cause summary

  4. Joelincn commented on Jun 2, 2026

    @Joelincn
    Author

    Code-level root cause pinpointed

    I traced the exact failure path in loadSqliteVecExtension in engine-storage-Dkl2KcXA.js.

    The bug

    1. If params.extensionPath is set → directly loads .so → works
    2. If not → tries ESM import("sqlite-vec") → fails with error type NOT matching isMissingSqliteVecPackageError → rethrows
    3. Outer catch returns { ok: false } → fallback to resolveSqliteVecPlatformVariant never executes

    isMissingSqliteVecPackageError only matches ERR_MODULE_NOT_FOUND / MODULE_NOT_FOUND. The bundled ESM runtime throws a different error type on Node 22/Linux.

    Config-level fix (confirmed working)

    Setting extensionPath bypasses the broken ESM import:

    "memorySearch": {
      "store": {
        "vector": {
          "extensionPath": "/home/joe/.npm-global/lib/node_modules/openclaw/node_modules/sqlite-vec-linux-x64/vec0.so"
        }
      }
    }

    Result: Vector store: ready on every restart, memory_search returns proper results with vectorScore.

    Suggested code fix

    The isMissingSqliteVecPackageError check should be removed or made non-fatal. When ESM import fails (any error type), it should always fall through to resolveSqliteVecPlatformVariant():

    // Current - too strict, only catches MODULE_NOT_FOUND:
    } catch (err) {
        if (!isMissingSqliteVecPackageError(err)) throw err;
        // fallback never reached for Node 22/Linux
    }
    
    // Fix - always fall through to platform variant:
    } catch (err) {
        const variant = resolveSqliteVecPlatformVariant();
        if (!variant) return { ok: false };
        params.db.loadExtension(variant.path);
        return { ok: true, extensionPath: variant.path };
    }

    Or simply try resolveSqliteVecPlatformVariant before the ESM import so the native .so is always attempted first.

  5. self-assigned this
    on Jun 8, 2026
  6. vincentkoc commented on Jun 8, 2026

    @vincentkoc
    Member

    Fixed on main in 355a9cb.

    What changed:

    • loadSqliteVecExtension still prefers a configured store.vector.extensionPath when one is set.
    • If the bundled sqlite-vec package import/load path fails, OpenClaw now attempts the resolved platform-specific native extension before giving up.
    • The fallback is still verified with SELECT vec_version() AS version, so a broken native load is not treated as ready.
    • If both paths fail, the returned error includes both the package error and platform-variant error plus the existing extensionPath hint.

    Proof run after the patch:

    • node scripts/run-vitest.mjs packages/memory-host-sdk/src/host/sqlite-vec.test.ts — 9 tests passed.
    • node scripts/sqlite-vec-smoke.mjs — loaded sqlite-vec and queried a vec0 table successfully.
    • node scripts/run-oxlint.mjs packages/memory-host-sdk/src/host/sqlite-vec.ts packages/memory-host-sdk/src/host/sqlite-vec.test.ts — clean.
    • git diff --check — clean.
    • Autoreview on final HEAD — clean, no accepted/actionable findings.
  7. locked as resolved and limited conversation to collaborators on Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Normal backlog priority with limited blast radius.bugSomething isn't workingbug:behaviorIncorrect behavior without a crashclawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions