-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
Bug
The WASM engine path crashes during buildStructure with:
Error: queryGet row failed: database disk image is malformed
Root cause
setupPipeline always opens both ctx.db (better-sqlite3, bundled SQLite) and ctx.nativeDb (rusqlite, separate bundled SQLite) on the same DB file, regardless of engine mode.
When engineName === 'wasm':
insertNodeswrites via better-sqlite3 (because it gates onctx.engineName === 'native')buildStructurereads viactx.nativeDb.queryGet()(no engine gate — just checks ifnativeDbexists)
Two different bundled SQLite copies accessing the same WAL file causes corruption. The rusqlite connection reads WAL state written by better-sqlite3's SQLite copy, and the WAL checksums/formats may be subtly incompatible.
Impact
- WASM engine builds fail with SQLite corruption when native addon is also available
- v3.5.0 build benchmark: both engines failed (WASM from this bug, native from refactor: remove dead WASM call-AST extraction and pre-3.2 edge shim #686)
Fix
Gate nativeDb usage in read stages (buildStructure, finalize, etc.) on ctx.engineName === 'native' to ensure consistent SQLite library usage within a single build. When engine is 'wasm', all DB operations should go through better-sqlite3.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels