**Resolved** CommandExecutor - database disk image is malformed


Sonarr version (exact version):
OS: unRAID 6.6.6
Docker version: 18.06.1-ce

CommandExecutor - Error occurred while executing task MessagingCleanup: database disk image is malformed database disk image is malformed.

Debug logs:

Error occurred while executing task MessagingCleanup: database disk image is malformed
database disk image is malformed

System.Data.SQLite.SQLiteException (0x80004005): database disk image is malformed
database disk image is malformed
  at System.Data.SQLite.SQLite3.Reset (System.Data.SQLite.SQLiteStatement stmt) [0x00083] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLite3.Step (System.Data.SQLite.SQLiteStatement stmt) [0x0003c] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLiteDataReader.NextResult () [0x0016b] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLiteDataReader..ctor (System.Data.SQLite.SQLiteCommand cmd, System.Data.CommandBehavior behave) [0x00090] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at (wrapper remoting-invoke-with-check) System.Data.SQLite.SQLiteDataReader..ctor(System.Data.SQLite.SQLiteCommand,System.Data.CommandBehavior)
  at System.Data.SQLite.SQLiteCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x0000c] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery (System.Data.CommandBehavior behavior) [0x00006] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery () [0x00006] in <61a20cde294d4a3eb43b9d9f6284613b>:0 
  at Marr.Data.DataMapper.Delete[T] (System.String tableName, System.Linq.Expressions.Expression`1[TDelegate] filter) [0x00091] in C:\BuildAgent\work\5d7581516c0ee5b3\src\Marr.Data\DataMapper.cs:803 
  at Marr.Data.DataMapper.Delete[T] (System.Linq.Expressions.Expression`1[TDelegate] filter) [0x00000] in C:\BuildAgent\work\5d7581516c0ee5b3\src\Marr.Data\DataMapper.cs:777 
  at NzbDrone.Core.Datastore.BasicRepository`1[TModel].Delete (System.Linq.Expressions.Expression`1[TDelegate] filter) [0x00000] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\Datastore\BasicRepository.cs:55 
  at NzbDrone.Core.Messaging.Commands.CommandRepository.Trim () [0x00022] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\Messaging\Commands\CommandRepository.cs:35 
  at NzbDrone.Core.Messaging.Commands.CommandQueueManager.CleanCommands () [0x0007b] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\Messaging\Commands\CommandQueueManager.cs:161 
  at NzbDrone.Core.Messaging.Commands.CleanupCommandMessagingService.Execute (NzbDrone.Core.Messaging.Commands.MessagingCleanupCommand message) [0x00000] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\Messaging\Commands\CleanupCommandMessagingService.cs:14 
  at NzbDrone.Core.Messaging.Commands.CommandExecutor.ExecuteCommand[TCommand] (TCommand command, NzbDrone.Core.Messaging.Commands.CommandModel commandModel) [0x000f6] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\Messaging\Commands\CommandExecutor.cs:95 
  at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,NzbDrone.Core.Messaging.Commands.CommandExecutor,object,NzbDrone.Core.Messaging.Commands.CommandModel)
  at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2] (System.Runtime.CompilerServices.CallSite site, T0 arg0, T1 arg1, T2 arg2) [0x0011e] in <e32d3889c5e24db788c761b532f9d8a8>:0 
  at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,NzbDrone.Core.Messaging.Commands.CommandExecutor,object,NzbDrone.Core.Messaging.Commands.CommandModel)
  at NzbDrone.Core.Messaging.Commands.CommandExecutor.ExecuteCommands () [0x00027] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\Messaging\Commands\CommandExecutor.cs:41

Description of issue:

I’m getting the follow error occurring every 5 minutes in the logs of my Sonarr container. So far as I can tell. Everything is working as expected. Still downloading files and UI is totally responsive. I’ve no idea when this started to occur as I have rarely had need to check the logs. I just wish to understand the cause of this error and stop it from happening if possible.

I’m using the Linuxserver/sonarr:latest docker container from Community Applications on unRAID 6.6.6. Although I don’t feel this error is anything specific to unRAID I am also a total newbie to sonarr and docker in general.

I’ve just switched logging mode to debug and will continue to gather them for the next day or so before posting a full debug log dump.

If anyone has insight or direction in the interim it would be greatly appreciated.



Your database is corrupt, you’re going to need to restore a backup that is not corrupt if one is available.


Many thanks for getting back and providing the link to documentation. From this I was able to roll back to a database from three weeks back and can now happily report no errors.

For other newbies in my position wondering. That is to say those using Docker containers on unRAID. The basic steps I carried out are as follows. This assumes you are extracting the .zip to another machine such as Windows 10 workstation.

  • download a backup .zip from sonarr WebUI.
  • Extract and copy onto any other accessible share on unRAID.
  • Stop the sonarr container.
  • Shell into your unRAID server and navigate to appdata/sonarr.
  • Delete the files mentioned in the article markus101 linked above.
  • Copy files from the backup placed on share earlier. (again see linked article).
  • Restart sonarr container.
  • Confirm problem is resolved.

If your not familiar with copying/moving deleting files in Linux. Invoke Midnight Commander from the terminal to get a nifty file manager. Only command you’ll really need is F6 to move each backup file to your /appdata/sonarr directory.

Hope this helps someone else who may have ran in to this and wasn’t too sure how to proceed.


Database file: /config/nzbdrone.db is corrupt, restore from backup if available

Just went through the steps and still getting the exact same error.