// SQLite error reference

SQLITE_IOERR: disk I/O error

The operating system reported an I/O error while SQLite read, wrote, synced or locked a file. The extended code says which operation failed.

Result code
SQLITE_IOERR
Name
10
Category
Primary result codes
Error message
disk I/O error

What it means

SQLITE_IOERR (10) means a file operation failed at the operating-system level. SQLite has many extended codes for it, such as SQLITE_IOERR_READ, SQLITE_IOERR_WRITE, SQLITE_IOERR_FSYNC, SQLITE_IOERR_SHORT_READ (fewer bytes than requested, for example a truncated file) and SQLITE_IOERR_LOCK. A full disk normally gives SQLITE_FULL instead.

The extended code is the best clue, so enable extended result codes or read them with sqlite3_extended_errcode().

Common causes

  • Failing or disconnected storage: a removed USB drive, an unmounted network share, a bad disk.
  • A network file system or sync folder that doesn't support the locking or syncing SQLite needs.
  • Antivirus or backup software holding or changing the file.
  • The file was truncated or replaced underneath an open connection.

How to fix it

  1. Read the extended code to see which operation failed, and check the operating system's logs for disk errors.

  2. Keep the database on a local disk. If it must be shared, don't share the file: put a server in front of it.

  3. Exclude the database, -journal, -wal and -shm files from antivirus scanning and file-sync tools.

  4. After any I/O error, check the file before trusting it.

    PRAGMA integrity_check;

Related errors

More primary result codes errors

The code and message text are from the SQLite result and error codes documentation. Browse the full SQLite error list or search every database error.

// fewer errors, faster fixes

Work on SQLite in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQLite and the other databases you use.