SQLITE_IOERR_SHORT_READ
SQLiteERRORCriticalI/O Errorofficial confidence

I/O error: short read (unexpected EOF)

Production Risk

Critical — database file is likely truncated or corrupt.

What this means

SQLITE_IOERR_SHORT_READ (522) is returned when a read from the database file returned fewer bytes than requested — typically indicating a truncated or corrupt file.

Why it happens
  1. 1Database file was truncated (e.g., by a disk-full condition during write).
  2. 2File copied incompletely.
  3. 3Partial write failure left the file smaller than its page count suggests.
How to reproduce

Any read operation that hits an unexpected end-of-file.

trigger — this will error
trigger — this will error
# Truncate a database file to simulate:
# truncate -s 1024 my.db
# Then try to open → SQLITE_IOERR_SHORT_READ

expected output

sqlite3.DatabaseError: disk I/O error

Fix 1

Fix 2

Fix 3

Sources
Official documentation ↗

sqlite3.h — SQLITE_IOERR_SHORT_READ = 522

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

← All SQLite errors