Test files › Databases › truncated.sqlite
Corrupt, truncated SQLite database
The same database cut off in the middle of the second page, so the header still looks correct but the data pages are incomplete.
↓ Download truncated.sqlite| Filename | truncated.sqlite |
| Format | SQLite |
| Size | 5.9 KB (6,000 bytes) |
| MIME type | application/vnd.sqlite3 |
| SHA-256 | 1b6fd338a1fc3e8d9b112f64a908fe6d83b2c951696efc5ab353e1c0e8215fd4 |
What this file catchesError handling for a partially-uploaded or interrupted database transfer. The signature and header validate, so extension and magic-number checks both pass, and opening it does not fail either: SQLite 3.50 reads the missing bytes as zeros and returns every row as (0, NULL, NULL, NULL). Only PRAGMA integrity_check reports the damage.
Handle it in code
Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.
Python
A truncated database usually opens and queries without any error: SQLite reads the missing bytes as zeros, so this file returns ten rows of (0, None, None, None). Run the integrity check before importing anything from an uploaded database.
import sqlite3
con = sqlite3.connect("file:truncated.sqlite?mode=ro", uri=True)
try:
result = con.execute("PRAGMA integrity_check").fetchone()[0]
print("integrity: ok" if result == "ok" else "rejected: " + " / ".join(result.splitlines()[:2]))
except sqlite3.DatabaseError as e:
print("rejected:", e)
finally:
con.close()Run against this file, it prints: rejected: *** in database main *** / Tree 2 page 2 cell 8: Rowid 0 out of order
Related guides and tools
Download & verify
curl -fsSL -o "truncated.sqlite" "https://files.hexaqa.com/db/truncated.sqlite"
curl -fsSL "https://files.hexaqa.com/db/truncated.sqlite" | sha256sum
# expect: 1b6fd338a1fc3e8d9b112f64a908fe6d83b2c951696efc5ab353e1c0e8215fd4