// SQLite error reference

SQLITE_READONLY_DBMOVED: database file moved while open

The database file was moved, renamed or deleted after it was opened, so SQLite refuses to write to it to avoid corrupting it.

Result code
SQLITE_READONLY_DBMOVED
Name
1032
Category
Extended result codes
Error message
attempt to write a readonly database

What it means

SQLITE_READONLY_DBMOVED (1032) means the database can't be modified because the file has moved since it was opened. If SQLite kept writing and the process crashed, its rollback journal would sit under the old name and couldn't be used to repair the file, so it stops writes instead.

Common causes

  • Renaming, moving or replacing the database file while a program has it open.
  • Deleting the file (for example a cleanup job or a test teardown) while a connection is still open.
  • Atomic file replacement by deployment or sync tools.

How to fix it

  1. Close all connections before moving or replacing the file, then reopen it at the new path.

  2. To swap in a new database, restore into the open connection with the backup API instead of replacing the file on disk.

Related errors

More extended result codes errors

The code and message text are from the SQLite result and error codes documentation. Browse the full SQLite error list or search every database error.

// fewer errors, faster fixes

Work on SQLite in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQLite and the other databases you use.