SQLITE_BUSY SQL Origin: Data OSI layer 7 · Application Last updated 13 Oct 2026

sqlite3.OperationalError: database is locked (SQLITE_BUSY)

Another connection holds a write lock on the SQLite file, and this one gave up waiting.

Exact message you may see database is locked
Seen on: SQL

Meaning

SQLite allows one writer at a time. Long transactions, open cursors, a DB browser holding the file, or many concurrent web workers cause lock contention.

Common causes

  • Concurrent writers (multiple workers/threads)
  • A long-running transaction or uncommitted write
  • DB Browser/IDE keeping the file open
  • Network filesystems (NFS/SMB) with broken locking

⚡ Quick fix

  1. Keep write transactions short and commit promptly
  2. Enable WAL mode and a busy timeout
  3. Close GUI tools holding the database
  4. Use PostgreSQL/MySQL for concurrent web workloads

Detailed fix by platform

SQL

  1. sql
    PRAGMA journal_mode = WAL;
    PRAGMA busy_timeout = 5000;

How to diagnose

  1. Writers — How many processes write?
  2. Holder — Any open transaction or tool?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

1205 — SQL Server Msg 1205: Transaction was deadlocked on lock resources and has been chosen as the deadlock victim (SQL)12051213 — MySQL ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction (MySQL)12131222 — SQL Server Msg 1222: Lock request time out period exceeded (SQL)1222Deadlock — Deadlock found when trying to get lock; try restarting transaction (SQL)Deadlockdisk I/O error — SQLite: disk I/O error (SQLITE_IOERR) (SQL)disk I/O errorError acquiring the state lock — Terraform: Error: Error acquiring the state lock — ConditionalCheckFailedException / state blob is already locked (Terraform)Error acquiring the s…Lock wait timeout — Lock wait timeout exceeded; try restarting transaction (MySQL 1205) (SQL)Lock wait timeoutmalformed database — sqlite3.DatabaseError: database disk image is malformed (SQL)malformed databaseSQLITE_BU…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.