Skip to content

SQLite: database is locked

Another connection holds a lock that SQLite needs to complete your operation.

database is locked
Database is locked by another process

SQLite uses locks to coordinate connections to the same file. The connection holding the lock can belong to TableAI, another database client or an application using that database.

Common causes include:

  • A write transaction that has not committed or rolled back.
  • An active operation that keeps a transaction open.
  • Several applications or containers writing to the same database file.
  1. Allow an active database operation to finish.
  2. Check other open connections to the same file.
  3. Inspect unfinished transactions in the application that owns them.
  4. Commit or roll back a transaction you own after reviewing its work.
  5. Check the failed operation’s outcome before retrying it.

For a database shared with Docker, identify which applications or containers use the volume. Check their logs and transaction controls.

Check the applications using the database on the remote host. Closing a local application does not release a transaction owned by a remote service. Ask the service owner to finish or roll back its transaction.

On a company host, send the administrator the error text, failure time and operation that failed. Include the SSH host and user when applicable; omit passwords and database contents.

For a local failure, TableAI can show Database is locked by another process. A remote failure can show the database is locked message from sqlite3. Read the operation’s error details before running the SQL again.

If the message concerns file access instead, use the file access guide.