SQLITE_IOERR_FSYNC
SQLiteFATALCriticalI/O Errorofficial confidence

I/O error during fsync()

Production Risk

Critical — committed data may not be durable.

What this means

SQLITE_IOERR_FSYNC (1034) is returned when the OS reports an error during an fsync() or FlushFileBuffers() call. SQLite calls fsync() to ensure data is durably written to disk before completing a transaction commit.

Why it happens
  1. 1Disk hardware failure during fsync.
  2. 2Some filesystems (e.g., certain NFS mounts) return EIO on fsync.
  3. 3SSD firmware bug causing fsync failure.
How to reproduce

Transaction commit (COMMIT statement) when fsync() fails.

trigger — this will error
trigger — this will error
# Triggered by hardware or filesystem issues during COMMIT
# PRAGMA synchronous = FULL forces fsync on every commit

expected output

sqlite3.DatabaseError: disk I/O error

Fix 1

Fix 2

Fix 3

What not to do

Sources
Official documentation ↗

sqlite3.h — SQLITE_IOERR_FSYNC = 1034

SQLite synchronous pragma

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

← All SQLite errors