Malformed database image

I got the error below last night. Is there anyway to recover or do I need to start my backups from scratch again?

Failed: The database disk image is malformed
database disk image is malformed
Details: Mono.Data.Sqlite.SqliteException (0x80004005): The database disk image is malformed
database disk image is malformed
  at Mono.Data.Sqlite.SQLite3.Reset (Mono.Data.Sqlite.SqliteStatement stmt) [0x00096] in <fe9fd999cd9f407db94500dce293e66f>:0
  at Mono.Data.Sqlite.SQLite3.Step (Mono.Data.Sqlite.SqliteStatement stmt) [0x00046] in <fe9fd999cd9f407db94500dce293e66f>:0
  at Mono.Data.Sqlite.SqliteDataReader.NextResult () [0x00129] in <fe9fd999cd9f407db94500dce293e66f>:0
  at Mono.Data.Sqlite.SqliteDataReader..ctor (Mono.Data.Sqlite.SqliteCommand cmd, System.Data.CommandBehavior behave) [0x00051] in <fe9fd999cd9f407db94500dce293e66f>:0
  at (wrapper remoting-invoke-with-check) Mono.Data.Sqlite.SqliteDataReader:.ctor (Mono.Data.Sqlite.SqliteCommand,System.Data.CommandBehavior)
  at Mono.Data.Sqlite.SqliteCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x00006] in <fe9fd999cd9f407db94500dce293e66f>:0
  at Mono.Data.Sqlite.SqliteCommand.ExecuteScalar () [0x00000] in <fe9fd999cd9f407db94500dce293e66f>:0
  at Duplicati.Library.Main.Database.LocalBackupDatabase.GetFirstPath () [0x00017] in <c6c6871f516b48f59d88f9d731c3ea4d>:0
  at Duplicati.Library.Main.Operation.BackupHandler+<RunAsync>d__19.MoveNext () [0x000ae] in <c6c6871f516b48f59d88f9d731c3ea4d>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
  at CoCoL.ChannelExtensions.WaitForTaskOrThrow (System.Threading.Tasks.Task task) [0x00050] in <6973ce2780de4b28aaa2c5ffc59993b1>:0
  at Duplicati.Library.Main.Operation.BackupHandler.Run (System.String[] sources, Duplicati.Library.Utility.IFilter filter) [0x00008] in <c6c6871f516b48f59d88f9d731c3ea4d>:0
  at Duplicati.Library.Main.Controller+<>c__DisplayClass13_0.<Backup>b__0 (Duplicati.Library.Main.BackupResults result) [0x00035] in <c6c6871f516b48f59d88f9d731c3ea4d>:0
  at Duplicati.Library.Main.Controller.RunAction[T] (T result, System.String[]& paths, Duplicati.Library.Utility.IFilter& filter, System.Action`1[T] method) [0x0011d] in <c6c6871f516b48f59d88f9d731c3ea4d>:0 

This error happens in SQLite sometimes, and the Internet has various ideas on how one can sometimes dump the broken database (assuming it cooperates…) and put its contents into a replacement database.

SQLiteException “database disk image is malformed” is one example, but really it appears case-by-case.

Database disk image is malformed is a case where a quite-database-savvy user managed to fix theirs up.

Another option is to Recreate the database after deleting the bad one (preferably saving off a copy first…). There have been reports that it’s faster to start again, but then you lose the ability to restore older versions.

Where is the database file that I need to fix? Is it on the backup server or on the machine that duplicati is running on?

Database management shows you the location in Local database path.

Hi, Jpschewe: Can you find the database file and connect to it with SQLITE3.(EXE) or a GUI tool such as then post the output of

PRAGMA integrity_check;

Because SQLITE doesn’t handle concurrency very well you might need to shut duplicati down before doing this.

This should not really be happening. SQLITE may be a ‘lite’ database, but it should be pretty resistant to corruption. (But, not immune)