SQLITE_BUSY_RECOVERY
SQLiteWARNINGNotableLockingofficial confidence

Busy: another connection is recovering WAL

Production Risk

Low — transient; resolves once WAL recovery finishes.

What this means

SQLITE_BUSY_RECOVERY (261) is an extended code returned when a database is in WAL mode and another connection is currently performing crash recovery (replaying the WAL). The caller should wait and retry.

Why it happens
  1. 1Application restarted after a crash; first connection to open the WAL database is performing recovery.
  2. 2Another process is replaying uncommitted WAL frames after an unclean shutdown.
How to reproduce

WAL-mode database open after an unclean shutdown with concurrent connections.

trigger — this will error
trigger — this will error
import sqlite3, time
for attempt in range(5):
    try:
        conn = sqlite3.connect('my.db', timeout=5)
        conn.execute('SELECT 1')
        break
    except sqlite3.OperationalError as e:
        if 'database is locked' in str(e):
            time.sleep(0.5)

expected output

Transient; retries succeed once recovery completes.

Fix 1

Fix 2

Version notes

Sources
Official documentation ↗

sqlite3.h — SQLITE_BUSY_RECOVERY = 261

WAL mode

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

← All SQLite errors