Unraid Binhex/Sonarr crashes constantly - EPIC FAIL

Sonarr version (exact version): Binhex production version (he has listed 4.0.0.748-1-01)
Mono version (if Sonarr is not running on Windows):
OS: UNRAID 6.12.4 - Docker Install
Debug logs:
Description of issue: Sonarr refuses to boot

at NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor.ProcessAlterTable(TableDefinition tableDefinition, List1 oldColumnDefinitions) in ./Sonarr.Core/Datastore/Migration/Framework/NzbDroneSqliteProcessor.cs:line 137 at NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor.Process(AlterColumnExpression expression) in ./Sonarr.Core/Datastore/Migration/Framework/NzbDroneSqliteProcessor.cs:line 45 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)

2024-01-08 00:00:38,523 DEBG ‘sonarr’ stdout output:
[Info] NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor: Rolling back transaction

2024-01-08 00:00:38,539 DEBG ‘sonarr’ stdout output:

2024-01-08 00:00:38,541 DEBG ‘sonarr’ stdout output:

2024-01-08 00:00:38,560 DEBG ‘sonarr’ stdout output:
[Fatal] ConsoleApp: EPIC FAIL!

[v4.0.0.748] NzbDrone.Common.Exceptions.SonarrStartupException: Sonarr failed to start: Error creating main database
—> System.Exception: constraint failed
UNIQUE constraint failed: Commands_temp.Id
While Processing:
“INSERT INTO “Commands_temp” (“Id”, “Name”, “Body”, “Priority”, “Status”, “QueuedAt”, “StartedAt”, “EndedAt”, “Duration”, “Exception”, “Trigger”, “Result”) SELECT “Id”, “Name”, “Body”, “Priority”, “Status”, “QueuedAt”, “StartedAt”, “EndedAt”, “Duration”, “Exception”, “Trigger”, “Result” FROM “Commands””
2024-01-08 00:00:38,560 DEBG ‘sonarr’ stdout output:

—> code = Constraint (19), message = System.Data.SQLite.SQLiteException (0x800027AF): constraint failed
UNIQUE constraint failed: Commands_temp.Id
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.Core/Datastore/Migration/Framework/NzbDroneSqliteProcessor.cs:line 137 at NzbDrone.Core.Datastore.Migration.Framework.NzbDroneSQLiteProcessor.Process(AlterColumnExpression expression) in ./Sonarr.Core/Datastore/Migration/Framework/NzbDroneSqliteProcessor.cs:line 45 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 ./Sonarr.Core/Datastore/Migration/Framework/MigrationController.cs:line 79 at NzbDrone.Core.Datastore.DbFactory.CreateMain(String connectionString, MigrationContext migrationContext, DatabaseType databaseType) in ./Sonarr.Core/Datastore/DbFactory.cs:line 116 --- End of inner exception stack trace --- at NzbDrone.Core.Datastore.DbFactory.CreateMain(String connectionString, MigrationContext migrationContext, DatabaseType databaseType) in ./Sonarr.Core/Datastore/DbFactory.cs:line 164 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:line 10 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 parentArgs, Object& result) in /
/src/DryIoc/Container.cs:line 3706
at DryIoc.Interpreter.TryInterpretMethodCall(IResolverContext r, MethodCallExpression callExpr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in //src/DryIoc/Container.cs:line 3504
at DryIoc.Interpreter.TryInterpret(IResolverContext r, Expression expr, IParameterProvider paramExprs, Object paramValues, ParentLambdaArgs parentArgs, Object& result) in /
/src/DryIoc/Container.cs:line 3155
at DryIoc.Interpreter.TryInterpretSingletonAndUnwrapContainerException(IResolverContext r, Expression expr, ImMapEntry1 itemRef, Object& result) in /_/src/DryIoc/Container.cs:line 3084 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

2024-01-08 00:00:38,599 DEBG ‘sonarr’ stdout output:
Press enter to exit…

2024-01-08 00:00:39,599 DEBG ‘sonarr’ stdout output:
Non-recoverable failure, waiting for user intervention…

1 Like

I have tried to reinstall and restore from older backups - this did not work.

I have tried to follow the instructions from Useful Tools | Servarr Wiki and each time I try to create the new db from the sql (Step 11) and it constantly throws errors where I had deleted giant swaths of text - all to no avail. (But I am unsure what needs to be done at instruction level “8. Overwrite old schema”)

Any suggestions? I really would rather not rebuilding from scratch. Thx

After deleting nearly everything in the old sql file, I was able to get back up with limited manual updates.

Yeah I tried the below command with no luck :frowning:

myUsername@MyServerName/mnt/user/appdata/sonarr# sqlite3 logs.db ".recover" | sqlite3 newlogs.db
myUsername@MyServerName:/mnt/user/appdata/sonarr# sqlite3 sonarr.db ".recover" | sqlite3 newsonarr.db

…Then deleting the original file, renaming the new ones to just logs.db / sonarr.db and starting. No luck.

Not sure how best to follow your “deleting nearly everything” in the old file route

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