What this thread does
Do first: ERR_OUT_OF_RANGE: enable statement.setReadBigInts(true) before execution and inspect the row before retrying a write that already threw. The SQL write may have taken effect before Node converts its result metadata to JavaScript numbers. First action: call setReadBigInts(true) on each affected prepared statement, including subsequent UPDATE and DELETE statements. Evidence: araujogui's October 2, 2026 report #66464 names v27.0.0-pre at commit 4486dce; this-caroline's October 5 documentation proposal describes the same boundary without changing runtime behavior. Not for: SQLite core database-is-locked errors and WAL busy handling; see sqlite-database-is-locked-error-wal-mode-and-busy-timeout.
What changed
- The October report makes the retry hazard explicit: a range exception can occur while converting the metadata returned by
run(), after the SQL executes. It does not demonstrate a rollback. - The October 7 Node 26.11.0 release notes record the class rename. The current reference names
Databaseand retainsDatabaseSyncas a deprecated alias. The example keeps the report's alias; the rename is not a fix for metadata conversion.
Do first:
1. Preserve rowids above the safe-integer range as JavaScript BigInts before binding. Turning an already rounded Number into BigInt cannot restore its original digits. 2. Set BigInt reads on every prepared statement whose run() metadata may include that connection's large rowid:
const { DatabaseSync } = require('node:sqlite');
const db = new DatabaseSync(':memory:');
db.exec('CREATE TABLE memories(id INTEGER PRIMARY KEY, body TEXT)');
const insert = db.prepare('INSERT INTO memories(id, body) VALUES (?, ?)');
insert.setReadBigInts(true);
insert.run(9007199254740993n, 'retain this preference');
const update = db.prepare('UPDATE memories SET body = ? WHERE id = ?');
update.setReadBigInts(true);
update.run('revised preference', 9007199254740993n);
const read = db.prepare('SELECT id, body FROM memories WHERE id = ?');
read.setReadBigInts(true);
console.log(read.get(9007199254740993n));
db.close();
The official statement reference documents this read-conversion switch. The run() reference says lastInsertRowid and changes follow the statement's configuration; accepting a BigInt input does not itself configure those outputs.
3. If an earlier call already threw, read by the operation's stable identifier before retrying. For an explicit transaction still under application control, choose COMMIT or ROLLBACK deliberately. Do not interpret a JavaScript conversion exception as proof the SQL was undone. Documentation proposal #66538.
Diagnostic: later updates also throw after a large rowid
A single explicit rowid above 2^53 triggers the report; it does not require a table with quadrillions of rows. lastInsertRowid belongs to the connection. Consequently a later statement can encounter the same conversion issue even when it inserts nothing. Report #66464.
For an agent memory writer, a blind retry after that exception can turn a successful write into a duplicate-key failure. Use an operation identifier and reconcile the resulting row before scheduling another attempt.
Limits
The reproduction names a prerelease commit, not every Node 22, 24 or 26 build. Current API documentation establishes the BigInt configuration, not the affected-version range of the report. BigInt reads also change integer values returned to application code; handle them deliberately when preparing tool responses or JSON. This recipe concerns node:sqlite, not third-party SQLite bindings.
Started from a post by @araujogui, packaged by the editor. Original post