Version 4 of Sonarr fails to start after update

I have watchtower setup and it would seem that overnight it updated my sonarr container to the latest version, however there would seem to be an database issue and it won’t start.
I’ve tried to roll back to a previous version but it won’t start now either. It seems that the database update has failed.

2023-12-31 08:16:27.7|Info|Bootstrap|Starting Sonarr - /app/sonarr/bin/Sonarr - Version 4.0.0.741
2023-12-31 08:16:27.9|Info|AppFolderInfo|Data directory is being overridden to [/config]
2023-12-31 08:16:27.9|Info|AppFolderInfo|Data directory is being overridden to [/config]
2023-12-31 08:16:28.5|Info|AppFolderInfo|Data directory is being overridden to [/config]
2023-12-31 08:16:28.8|Info|MigrationController|*** Migrating data source=/config/sonarr.db;cache size=-20000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3;b>
2023-12-31 08:16:29.1|Info|FluentMigrator.Runner.MigrationRunner|188: postgres_update_timestamp_columns_to_with_timezone migrating
2023-12-31 08:16:29.2|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|Beginning Transaction
2023-12-31 08:16:29.2|Info|postgres_update_timestamp_columns_to_with_timezone|Starting migration of Main DB to 188
2023-12-31 08:16:29.2|Info|FluentMigrator.Runner.MigrationRunner|AlterTable Blocklist
2023-12-31 08:16:29.2|Info|FluentMigrator.Runner.MigrationRunner|=> 0.0011706s
2023-12-31 08:16:29.2|Info|FluentMigrator.Runner.MigrationRunner|AlterColumn Blocklist Date DateTimeOffset
2023-12-31 08:16:29.3|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|CREATE TABLE “Blocklist_temp” (“Id” INTEGER NOT NULL PRIMARY KEY AUTOINC>
2023-12-31 08:16:29.3|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|INSERT INTO “Blocklist_temp” (“Id”, “SeriesId”, “EpisodeIds”, "SourceTit>
2023-12-31 08:16:29.3|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|DROP TABLE “Blocklist”
2023-12-31 08:16:29.4|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|ALTER TABLE “Blocklist_temp” RENAME TO “Blocklist”
2023-12-31 08:16:29.4|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|CREATE INDEX “IX_Blacklist_SeriesId” ON “Blocklist” (“SeriesId” ASC)
2023-12-31 08:16:29.4|Info|FluentMigrator.Runner.MigrationRunner|=> 0.1646446s
2023-12-31 08:16:29.4|Info|FluentMigrator.Runner.MigrationRunner|AlterTable Blocklist
2023-12-31 08:16:29.4|Info|FluentMigrator.Runner.MigrationRunner|=> 4.8E-05s
2023-12-31 08:16:29.4|Info|FluentMigrator.Runner.MigrationRunner|AlterColumn Blocklist PublishedDate DateTimeOffset
2023-12-31 08:16:29.4|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|CREATE TABLE “Blocklist_temp” (“Id” INTEGER NOT NULL PRIMARY KEY AUTOINC>
2023-12-31 08:16:29.4|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|INSERT INTO “Blocklist_temp” (“Id”, “SeriesId”, “EpisodeIds”, "SourceTit>
2023-12-31 08:16:29.4|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|DROP TABLE “Blocklist”
2023-12-31 08:16:29.4|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|ALTER TABLE “Blocklist_temp” RENAME TO “Blocklist”
2023-12-31 08:16:29.4|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|CREATE INDEX “IX_Blacklist_SeriesId” ON “Blocklist” (“SeriesId” ASC)
2023-12-31 08:16:29.4|Info|FluentMigrator.Runner.MigrationRunner|=> 0.0491511s
2023-12-31 08:16:29.4|Info|FluentMigrator.Runner.MigrationRunner|AlterTable Commands
2023-12-31 08:16:29.4|Info|FluentMigrator.Runner.MigrationRunner|=> 1.7E-06s
2023-12-31 08:16:29.4|Info|FluentMigrator.Runner.MigrationRunner|AlterColumn Commands QueuedAt DateTimeOffset
2023-12-31 08:16:29.4|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|CREATE TABLE “Commands_temp” (“Id” INTEGER NOT NULL PRIMARY KEY AUTOINCR>
2023-12-31 08:16:29.4|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|INSERT INTO “Commands_temp” (“Id”, “Name”, “Body”, “Priority”, “Status”,>
2023-12-31 08:16:29.5|Error|FluentMigrator.Runner.MigrationRunner|database disk image is malformed
database disk image is malformed
While Processing:
"INSERT INTO “Commands_temp” (“Id”, “Name”, “Body”, “Priority”, “Status”, “QueuedAt”, “StartedAt”, “EndedAt”, “Duration”, “Exception”, “Trigger”, “Result”) SELECT “Id”>

[v4.0.0.741] System.Exception: database disk image is malformed
database disk image is malformed
While Processing:
"INSERT INTO “Commands_temp” (“Id”, “Name”, “Body”, “Priority”, “Status”, “QueuedAt”, “StartedAt”, “EndedAt”, “Duration”, “Exception”, “Trigger”, “Result”) SELECT “Id”>
—> code = Corrupt (11), message = System.Data.SQLite.SQLiteException (0x800007EF): 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)
— End of inner exception stack trace —
at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.ExecuteNonQuery(String sql)
at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.Process(String sql)
at NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor.ProcessAlterTable(TableDefinition tableDefinition, List1 oldColumnDefinitions) in ./Sonarr.C> at NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor.Process(AlterColumnExpression expression) in ./Sonarr.Core/Datastore/Migration/Framework/NzbD> at FluentMigrator.Expressions.AlterColumnExpression.ExecuteWith(IMigrationProcessor processor) at FluentMigrator.Runner.MigrationRunner.<>c__DisplayClass80_0.<ExecuteExpressions>b__1() at FluentMigrator.Runner.StopWatch.Time(Action action) at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions(ICollection1 expressions)

2023-12-31 08:16:29.7|Info|NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor|Rolling back transaction
2023-12-31 08:16:29.7|Fatal|ConsoleApp|EPIC FAIL!

[v4.0.0.741] NzbDrone.Common.Exceptions.SonarrStartupException: Sonarr failed to start: Error creating main database
—> System.Exception: database disk image is malformed
database disk image is malformed
While Processing:
"INSERT INTO “Commands_temp” (“Id”, “Name”, “Body”, “Priority”, “Status”, “QueuedAt”, “StartedAt”, “EndedAt”, “Duration”, “Exception”, “Trigger”, “Result”) SELECT “Id”>
—> code = Corrupt (11), message = System.Data.SQLite.SQLiteException (0x800007EF): 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)
— End of inner exception stack trace —
at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.ExecuteNonQuery(String sql)
at FluentMigrator.Runner.Processors.SQLite.SQLiteProcessor.Process(String sql)
at NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor.ProcessAlterTable(TableDefinition tableDefinition, List1 oldColumnDefinitions) in ./Sonarr.C> at NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor.Process(AlterColumnExpression expression) in ./Sonarr.Core/Datastore/Migration/Framework/NzbD> at FluentMigrator.Expressions.AlterColumnExpression.ExecuteWith(IMigrationProcessor processor) at FluentMigrator.Runner.MigrationRunner.<>c__DisplayClass80_0.<ExecuteExpressions>b__1() at FluentMigrator.Runner.StopWatch.Time(Action action) at FluentMigrator.Runner.MigrationRunner.ExecuteExpressions(ICollection1 expressions)
at FluentMigrator.Runner.MigrationRunner.ExecuteMigration(IMigration migration, Action2 getExpressions) at FluentMigrator.Runner.MigrationRunner.ApplyMigrationUp(IMigrationInfo migrationInfo, Boolean useTransaction) at FluentMigrator.Runner.MigrationRunner.MigrateUp(Int64 targetVersion, Boolean useAutomaticTransactionManagement) at FluentMigrator.Runner.MigrationRunner.MigrateUp(Boolean useAutomaticTransactionManagement) at FluentMigrator.Runner.MigrationRunner.MigrateUp() at NzbDrone.Core.Datastore.Migration.Framework.MigrationController.Migrate(String connectionString, MigrationContext migrationContext, DatabaseType databaseType) in> at NzbDrone.Core.Datastore.DbFactory.CreateMain(String connectionString, MigrationContext migrationContext, DatabaseType databaseType) in ./Sonarr.Core/Datastore/Db> --- End of inner exception stack trace --- at NzbDrone.Core.Datastore.DbFactory.CreateMain(String connectionString, MigrationContext migrationContext, DatabaseType databaseType) in ./Sonarr.Core/Datastore/Db> at NzbDrone.Core.Datastore.DbFactory.Create(MigrationContext migrationContext) in ./Sonarr.Core/Datastore/DbFactory.cs:line 71 at NzbDrone.Core.Datastore.DbFactory.Create(MigrationType migrationType) in ./Sonarr.Core/Datastore/DbFactory.cs:line 59 at NzbDrone.Core.Datastore.Extensions.CompositionExtensions.<>c.<AddDatabase>b__0_0(IDbFactory f) in ./Sonarr.Core/Datastore/Extensions/CompositionExtensions.cs:lin> at DryIoc.Registrator.ToFuncWithObjParams[D1,TService](Func2 f, Object d1) in /_/src/DryIoc/Container.cs:line 8046
at DryIoc.Interpreter.TryInterpretFuncInvoke(IResolverContext r, MethodCallExpression e, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentA>
at DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, MethodCallExpression callExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs >
at DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& resu>
at DryIoc.Interpreter.TryInterpretSingletonAndUnwrapContainerException(IResolverContext r, Expression expr, ImMapEntry1 itemRef, Object& result) in /_/src/DryIoc/C> at DryIoc.Factory.ApplyReuse(Expression serviceExpr, Request request) in /_/src/DryIoc/Container.cs:line 11110 at DryIoc.Factory.GetExpressionOrDefault(Request request) in /_/src/DryIoc/Container.cs:line 11029 at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) in /_/src/DryIoc/Container.cs:line 12056 at DryIoc.Factory.GetExpressionOrDefault(Request request) in /_/src/DryIoc/Container.cs:line 11012 at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) in /_/src/DryIoc/Container.cs:line 12056 at DryIoc.Factory.GetExpressionOrDefault(Request request) in /_/src/DryIoc/Container.cs:line 11012 at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) in /_/src/DryIoc/Container.cs:line 12056 at DryIoc.Factory.GetExpressionOrDefault(Request request) in /_/src/DryIoc/Container.cs:line 11012 at DryIoc.Container.ResolveAndCache(Int32 serviceTypeHash, Type serviceType, IfUnresolved ifUnresolved) in /_/src/DryIoc/Container.cs:line 423 at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType, IfUnresolved ifUnresolved) in /_/src/DryIoc/Container.cs:line 389 at DryIoc.Resolver.Resolve[TService](IResolver resolver, IfUnresolved ifUnresolved) in /_/src/DryIoc/Container.cs:line 8581 at Sonarr.Http.ClientSchema.SchemaBuilder.Initialize(IContainer container) in ./Sonarr.Http/ClientSchema/SchemaBuilder.cs:line 24 at NzbDrone.Host.Bootstrap.<>c__DisplayClass3_0.<CreateConsoleHostBuilder>b__2(IContainer c) in ./Sonarr.Host/Bootstrap.cs:line 150 at Microsoft.Extensions.Hosting.HostingHostBuilderExtensions.<>c__DisplayClass10_01.b__0(HostBuilderContext context, TContainerBuilder builder)
at Microsoft.Extensions.Hosting.Internal.ConfigureContainerAdapter1.ConfigureContainer(HostBuilderContext hostContext, Object containerBuilder) at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider() at Microsoft.Extensions.Hosting.HostBuilder.Build() at NzbDrone.Host.Bootstrap.Start(String[] args, Action1 trayCallback) in ./Sonarr.Host/Bootstrap.cs:line 80
at NzbDrone.Console.ConsoleApp.Main(String args) in ./Sonarr.Console/ConsoleApp.cs:line 45

Ive tried to go back a version or two, and while it will load the web ui, it throws sql errors on the page

You need to seek support from sonarr directly as it looks like you’ve got database issues.

Same issue - just updated sonarr on unraid.

Same answer

Fair enough.
As sonarr has been running stable and updating without issues for years now, I thought there might be something broken with the 12/31 update today.

Didnt’t have time to tinker around as it’s new years soon - New install and setup works, library is being rebuilt, hooks work.

If anyone else gets this issue, it would seem that my database was corrupted and it may be working fine in older versions however it would seem that ver 4 is a huge change and isn’t happy with any issues.
I followed the instructions here Useful Tools | Servarr Wiki
and all is well again

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