pgref.dev/sqlite/errors/SQLITE_IOERR_SHMSIZE
SQLITE_IOERR_SHMSIZEERRORTier 2 — Caution⚠️ MEDIUM confidence

I/O error resizing WAL shared-memory file

Category: I/O ErrorVersions: 3.7.0+

🔴 Production Risk Error

High — WAL writes will fail.

What this means

SQLITE_IOERR_SHMSIZE (4874) is returned when SQLite cannot extend the WAL shared-memory (-shm) file to the required size, usually because of a disk-full condition.

Why it happens

  1. 1Disk full preventing -shm file from being extended.
  2. 2OS error during ftruncate() or write() to the -shm file.

How to reproduce

WAL writes that require extending the -shm file.

trigger — this will ERROR
# df -h /path/to/database/  # check if disk is full
sqlite3.OperationalError: disk I/O error

Fix 1

Why this works

Free disk space on the filesystem containing the database.

Fix 2

Why this works

Use PRAGMA wal_autocheckpoint to keep WAL and -shm files small.

Sources

📚 Official docs: https://www.sqlite.org/rescode.html#ioerr_shmsize

🔧 Source ref: sqlite3.h — SQLITE_IOERR_SHMSIZE = 4874

Confidence assessment

⚠️ MEDIUM confidence

Stable.

See also

⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →