DB corruption error after update

Sonarr version (exact version): 2.0.0.5225
Mono version (if Sonarr is not running on Windows):
OS: Windows 10 v1803 - 17134.81
Debug logs:
(Make sure debug logging is enabled in settings and post the full log to hastebin/pastebin/dropbox/google drive or something similar, do not post them directly here. Post in .txt not .doc, .rtf or some other formatted document)
Description of issue:
After last nights update the Sonarr service will no longer start. Looking through the logs I find the message below. I tried a complete un-install/re-install as well as restoring the DB from several different backups all with the same result. The only way I can get it to start is to delete the DB and let the app re-create it which leaves me without any of my configuration. Any help would be appreciated.

[v2.0.0.5225] System.Exception: database disk image is malformed
database disk image is malformed
While Processing:
“CREATE INDEX “IX_History_EpisodeId_Date” ON “History” (“EpisodeId” ASC, “Date” DESC)” —> System.Data.SQLite.SQLiteException: database disk image is malformed
database disk image is malformed
at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
at System.Data.SQLite.SQLiteDataReader.NextResult()
at System.Data.SQLite.SQLiteDataReader…ctor(SQLiteCommand cmd, CommandBehavior behave)
at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.ExecuteNonQuery(String sql) in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\Processors\SQLite\SQLiteProcessor.cs:line 147
— End of inner exception stack trace —
at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.ExecuteNonQuery(String sql) in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\Processors\SQLite\SQLiteProcessor.cs:line 151
at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.Process(String sql) in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\Processors\SQLite\SQLiteProcessor.cs:line 135
at FluentMigrator.Runner.Processors.ProcessorBase.Process(CreateIndexExpression expression) in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\Processors\ProcessorBase.cs:line 95
at FluentMigrator.Expressions.CreateIndexExpression.ExecuteWith(IMigrationProcessor processor) in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator\Expressions\CreateIndexExpression.cs:line 46
at FluentMigrator.Runner.MigrationRunner.<>c__DisplayClass72_0.b__1() in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\MigrationRunner.cs:line 489
at FluentMigrator.Runner.StopWatch.Time(Action action) in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\StopWatch.cs:line 57
at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions(ICollection`1 expressions) in C:\Users\Mark\Source\Repos\fluentmigrator\src\FluentMigrator.Runner\MigrationRunner.cs:line 489

I was able to repair and regain most of the stuff I think. I used DB Browser for SQLite to export the DB backup to a SQL DB. I then re-imported it into a new SQLite DB and was able to start Sonarr using the new DB. It did take it a little while to stabilize and had quite a few things in the queue ready for import but it eventually worked it out after a reboot.

I am experiencing the same problem, though on a Raspberry Pi 3B.

Sonarr version (exact version): 2.0.0.5225
Mono version (if Sonarr is not running on Windows): 5.10.1.20 date 2018.03.29 11:55:26
OS: Raspbian Jessie

According to the update log the update was successful: it was only when Sonarr restarted that the problem described above reared its head.

18-6-19 18:06:14.6|Fatal|ConsoleApp|EPIC FAIL!

[v2.0.0.5225] System.Exception: database disk image is malformed
database disk image is malformed
While Processing:
“CREATE INDEX “IX_History_EpisodeId_Date” ON “History” (“EpisodeId” ASC, “Date” DESC)” —> System.Data.SQLite.SQLiteException: 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 FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.ExecuteNonQuery (System.String sql) [0x00013] in <137fb96feee44f379d6a8fba4e172d1c>:0
— End of inner exception stack trace —
at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.ExecuteNonQuery (System.String sql) [0x0003e] in <137fb96feee44f379d6a8fba4e172d1c>:0
at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.Process (System.String sql) [0x0003f] in <137fb96feee44f379d6a8fba4e172d1c>:0
at FluentMigrator.Runner.Processors.ProcessorBase.Process (FluentMigrator.Expressions.CreateIndexExpression expression) [0x0000d] in <137fb96feee44f379d6a8fba4e172d1c>:0
at FluentMigrator.Expressions.CreateIndexExpression.ExecuteWith (FluentMigrator.IMigrationProcessor processor) [0x00000] in :0
at FluentMigrator.Runner.MigrationRunner+<>c__DisplayClass72_0.b__1 () [0x00011] in <137fb96feee44f379d6a8fba4e172d1c>:0
at FluentMigrator.Runner.StopWatch.Time (System.Action action) [0x00006] in <137fb96feee44f379d6a8fba4e172d1c>:0
at FluentMigrator.Runner.MigrationRunner.AnnounceTime (System.String message, System.Action action) [0x0000c] in <137fb96feee44f379d6a8fba4e172d1c>:0
at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions (System.Collections.Generic.ICollection1[T] expressions) [0x000a5] in <137fb96feee44f379d6a8fba4e172d1c>:0 at FluentMigrator.Runner.MigrationRunner.ExecuteMigration (FluentMigrator.IMigration migration, System.Action2[T1,T2] getExpressions) [0x0005a] in <137fb96feee44f379d6a8fba4e172d1c>:0
at FluentMigrator.Runner.MigrationRunner.ApplyMigrationUp (FluentMigrator.Infrastructure.IMigrationInfo migrationInfo, System.Boolean useTransaction) [0x0010f] in <137fb96feee44f379d6a8fba4e172d1c>:0
at FluentMigrator.Runner.MigrationRunner.MigrateUp (System.Boolean useAutomaticTransactionManagement) [0x000af] in <137fb96feee44f379d6a8fba4e172d1c>:0
at NzbDrone.Core.Datastore.Migration.Framework.MigrationController.Migrate (System.String connectionString, NzbDrone.Core.Datastore.Migration.Framework.MigrationContext migrationContext) [0x0009e] in $
at NzbDrone.Core.Datastore.DbFactory.Create (NzbDrone.Core.Datastore.Migration.Framework.MigrationContext migrationContext) [0x00048] in :0
at NzbDrone.Core.Datastore.DbFactory.Create (NzbDrone.Core.Datastore.Migration.Framework.MigrationType migrationType) [0x00010] in :0
at NzbDrone.Core.Datastore.DbFactory.RegisterDatabase (NzbDrone.Common.Composition.IContainer container) [0x00006] in :0
at NzbDrone.Host.NzbDroneServiceFactory.Start () [0x00037] in <064c9c77e2a14dad9acb91a59dbafa71>:0
at NzbDrone.Host.Router.Route (NzbDrone.Host.ApplicationModes applicationModes) [0x0007b] in <064c9c77e2a14dad9acb91a59dbafa71>:0
at NzbDrone.Host.Bootstrap.Start (NzbDrone.Host.ApplicationModes applicationModes, NzbDrone.Common.EnvironmentInfo.StartupContext startupContext) [0x00047] in <064c9c77e2a14dad9acb91a59dbafa71>:0
at NzbDrone.Host.Bootstrap.Start (NzbDrone.Common.EnvironmentInfo.StartupContext startupContext, NzbDrone.Host.IUserAlert userAlert, System.Action`1[T] startCallback) [0x00075] in <064c9c77e2a14dad9acb91a59dbafa71>:0
at NzbDrone.Console.ConsoleApp.Main (System.String[] args) [0x0002f] in :0

It should be noted that the problem occurs at the same place i.e. “CREATE INDEX “IX_History_EpisodeId_Date”

I have tried reinstalling from two DB backups. I have also tried both updating and reinstalling the software.

Any assistance much appreciated !

Alternatively is it possible to roll back the update by re-installing the previous version of Sonarr ?

Again, many thanks

Recovering the DB will be your best bet, which involves dumping it to another file and re-creating the DB from the dump.

https://stackoverflow.com/a/18260642/882971 has the basic steps, the DB is named nzbdrone.db and is in the AppData Folder.

Thanks for the suggestion - will give it a try.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.