SQLITE_ERROR_SNAPSHOT
SQLiteERRORNotableSnapshotofficial confidence

Snapshot is out of date

Production Risk

Medium — snapshot-based reads must re-acquire a valid snapshot.

What this means

SQLITE_ERROR_SNAPSHOT (769) is returned by sqlite3_snapshot_open() when the requested historical snapshot is no longer available because the WAL has been checkpointed past that point.

Why it happens
  1. 1WAL checkpoint occurred after the snapshot was taken, invalidating it.
  2. 2Snapshot too old — WAL frames it references have been removed.
How to reproduce

sqlite3_snapshot_open() when the snapshot version is no longer in the WAL.

trigger — this will error
trigger — this will error
# In C:
# sqlite3_snapshot *snap;
# sqlite3_snapshot_get(db, "main", &snap);
# ... WAL checkpoint happens ...
# sqlite3_snapshot_open(db, "main", snap) → SQLITE_ERROR_SNAPSHOT

expected output

SQLITE_ERROR_SNAPSHOT (769)

Fix 1

Fix 2

What not to do

Version notes

Sources
Official documentation ↗

sqlite3.h — SQLITE_ERROR_SNAPSHOT = 769

sqlite3_snapshot_open()

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All SQLite errors