#2521·mempalace

mempalace-native: read-only open fails on a WAL database without sidecars

Author: igorlsCreated Sep 15, 2026Updated Sep 15, 2026

What happens

VectorIndex::load_from_sqlite (crates/mempalace-core/src/lib.rs) opens the sqlite_exact database with SQLITE_OPEN_READ_ONLY | SQLITE_OPEN_URI. A clean WAL-mode database usually has no -wal/-shm sidecars after its last writer closes, and on SQLite builds that cannot create the shared-memory index from a read-only connection this fails with SQLITE_CANTOPEN. That is the same failure class #2490 fixed on the Python side for #2489 (Apple's system SQLite).

Impact

  • Inside MemPalace, RustExactCollection._ensure_native_index catches the load error, logs Failed to load Rust native vector index, and queries fall back to the Python sqlite_exact path, so rust_exact silently loses its native speed-up rather than failing.
  • The standalone mempalace-native executable has no fallback, so stats / bench / search fail on such a database.

Expected

Mirror config.connect_sqlite_read: when the file is WAL (header byte 18 == 2) and both sidecars are absent, open read-write (or otherwise establish the WAL index) instead of read-only.

Raised by Copilot on #2519 (review of the v3.10.0 promotion) and verified against develop @ ce54d5d. Not a release blocker for default installs.