SQLITE_READONLY_ROLLBACK
SQLiteWARNINGNotableRead-Onlyofficial confidence

Read-only: rollback journal prevents read

Production Risk

High — database is inaccessible until journal is processed.

What this means

SQLITE_READONLY_ROLLBACK (776) is returned when a read-only database has a hot journal that needs to be rolled back, but the connection cannot write the journal file to perform the rollback.

Why it happens
  1. 1Crash left a hot journal (-journal file) alongside the read-only database.
  2. 2Read-only connection cannot roll back the journal.
How to reproduce

Read-only access to a database with an orphaned rollback journal.

trigger — this will error
trigger — this will error
# A -journal file exists but db is opened read-only
# SQLITE_READONLY_ROLLBACK prevents reads until journal is cleared

expected output

sqlite3.OperationalError: attempt to write a readonly database

Fix 1

Fix 2

What not to do

Sources
Official documentation ↗

sqlite3.h — SQLITE_READONLY_ROLLBACK = 776

SQLite journaling modes

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

← All SQLite errors