SQLiteSQLite SQLITE_BUSY
SQLite: Database Is Locked
SQLite SQLITE_BUSY means another process or connection has locked the database file and the current operation cannot proceed. SQLite uses file-level locking and allows only one writer at a time.
Example Query
-- Two processes opening the same .db file and writing simultaneously
Common Causes
- 1Two application instances writing to the same SQLite file concurrently
- 2A long-running transaction holding the write lock
- 3Unclosed connection from a crashed process still locking the file
How to Fix It
Use WAL mode for better concurrency: PRAGMA journal_mode=WAL. Set a busy timeout: PRAGMA busy_timeout=5000. Ensure all connections are properly closed. For high-concurrency workloads, consider migrating to PostgreSQL or MySQL.
Need a reliable database?
Try Supabase — free PostgreSQL with a generous free tier. No credit card required.
Got a query causing this error?
Paste it into SQLbuddy and get an instant plain-English explanation with optimization tips.
Analyze My Query →