[10.11.0 RC6] 'FOREIGN KEY constraint failed' Error on database migration #7349

Closed
opened 2026-02-07 04:51:17 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @lutzbat on GitHub (Sep 25, 2025).

Description of the bug

I wanted to upgrade for testing from version 10.10.7 to 10.11.0 RC6 but the startup migration throws an 'FOREIGN KEY constraint failed' error on saving ItemValues.

Before I updated, I removed all Plugins from the UI and the plugins folder, if that's relevant.

Reproduction steps

I can reproduce this behavior by replacing the config folder with a backup I made from version 10.10.7 and attempt to upgrade to 10.11.0 RC6 again.

What is the current bug behavior?

Database migration throws an error and therefore does not successfully migrate.

What is the expected correct behavior?

Database migration successfully migrate the current database to the new EFCore database.

Jellyfin Server version

Master

Specify commit id

2aa39226c6

Specify unstable release number

No response

Specify version number

No response

Specify the build version

Can not get into the dashboard

Environment

- OS: Ubuntu 24.04.3
- Linux Kernel: 6.8.0
- Virtualization: Docker
- Reverse Proxy: traefik
- Base URL: none
- Networking: Bridge
- Jellyfin Data Storage: local SSD
- Media Storage: local HDD

Jellyfin logs

[11:06:51] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Cleanup database
[11:06:51] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Cleanup database took '00:00:00.0182432'
[11:06:51] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Moving TypedBaseItem
[11:06:51] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Loading TypedBaseItems
[11:06:53] [WRN] [12] Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService: Health check StartupCheck with status Degraded completed after 0.6638ms with message 'Server is still starting up.'
[11:06:56] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Loading TypedBaseItems took '00:00:05.3233864'
[11:06:56] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Clean TypedBaseItems hierarchy
[11:06:58] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Clean TypedBaseItems hierarchy took '00:00:01.8507991'
[11:06:58] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Saving 38165 BaseItem entries
[11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Saving 38165 BaseItem entries took '00:00:13.7594974'
[11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Moving TypedBaseItem took '00:00:20.9621546'
[11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Moving ItemValues
[11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Loading ItemValues
[11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Loading ItemValues took '00:00:00.1555740'
[11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Saving 4693 ItemValues entries
[11:07:12] [ERR] [7] Microsoft.EntityFrameworkCore.Database.Command: Failed executing DbCommand (1ms) [Parameters=[@p0='?' (DbType = Guid), @p1='?' (DbType = Guid)], CommandType='Text', CommandTimeout='30']
INSERT INTO "ItemValuesMap" ("ItemId", "ItemValueId")
VALUES (@p0, @p1);
SELECT changes();
[11:07:12] [ERR] [7] Microsoft.EntityFrameworkCore.Update: An exception occurred in the database while saving changes for context type 'Jellyfin.Database.Implementations.JellyfinDbContext'.
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t)
   at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t)
   at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
[11:07:12] [ERR] [7] Jellyfin.Database.Implementations.JellyfinDbContext: Error trying to save changes.
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t)
   at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Jellyfin.Database.Implementations.JellyfinDbContext.<>n__1(Boolean acceptAllChangesOnSuccess)
   at Jellyfin.Database.Implementations.JellyfinDbContext.<>c__DisplayClass63_1.<SaveChanges>b__0()
   at Jellyfin.Database.Implementations.Locking.NoLockBehavior.OnSaveChanges(JellyfinDbContext context, Action saveChanges)
   at Jellyfin.Database.Implementations.JellyfinDbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
[11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Saving 4693 ItemValues entries took '00:00:00.2923893'
[11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Moving ItemValues took '00:00:00.4509929'
[11:07:12] [FTL] [7] InternalCodeMigration: Error: An error occurred while saving the entity changes. See the inner exception for details.
[11:07:12] [ERR] [7] InternalCodeMigration: Migration 20250420200000_MigrateLibraryDb failed
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t)
   at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Jellyfin.Database.Implementations.JellyfinDbContext.<>n__1(Boolean acceptAllChangesOnSuccess)
   at Jellyfin.Database.Implementations.JellyfinDbContext.<>c__DisplayClass63_1.<SaveChanges>b__0()
   at Jellyfin.Database.Implementations.Locking.NoLockBehavior.OnSaveChanges(JellyfinDbContext context, Action saveChanges)
   at Jellyfin.Database.Implementations.JellyfinDbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges()
   at Jellyfin.Server.Migrations.Routines.MigrateLibraryDb.Perform()
   at Jellyfin.Server.Migrations.Stages.CodeMigration.Perform(IServiceProvider serviceProvider, IStartupLogger logger, CancellationToken cancellationToken)
   at Jellyfin.Server.Migrations.JellyfinMigrationService.InternalCodeMigration.PerformAsync(IStartupLogger logger)
   at Jellyfin.Server.Migrations.JellyfinMigrationService.MigrateStepAsync(JellyfinMigrationStageTypes stage, IServiceProvider serviceProvider)
[11:07:12] [INF] [7] InternalCodeMigration: Attempt to rollback librarydb.
[11:07:12] [INF] [7] InternalCodeMigration: Attempt to rollback JellyfinDb.
[11:07:12] [FTL] [7] Main: Error while starting server
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'.
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t)
   at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Jellyfin.Database.Implementations.JellyfinDbContext.<>n__1(Boolean acceptAllChangesOnSuccess)
   at Jellyfin.Database.Implementations.JellyfinDbContext.<>c__DisplayClass63_1.<SaveChanges>b__0()
   at Jellyfin.Database.Implementations.Locking.NoLockBehavior.OnSaveChanges(JellyfinDbContext context, Action saveChanges)
   at Jellyfin.Database.Implementations.JellyfinDbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges()
   at Jellyfin.Server.Migrations.Routines.MigrateLibraryDb.Perform()
   at Jellyfin.Server.Migrations.Stages.CodeMigration.Perform(IServiceProvider serviceProvider, IStartupLogger logger, CancellationToken cancellationToken)
   at Jellyfin.Server.Migrations.JellyfinMigrationService.InternalCodeMigration.PerformAsync(IStartupLogger logger)
   at Jellyfin.Server.Migrations.JellyfinMigrationService.MigrateStepAsync(JellyfinMigrationStageTypes stage, IServiceProvider serviceProvider)
   at Jellyfin.Server.Migrations.JellyfinMigrationService.MigrateStepAsync(JellyfinMigrationStageTypes stage, IServiceProvider serviceProvider)
   at Jellyfin.Server.Migrations.JellyfinMigrationService.MigrateStepAsync(JellyfinMigrationStageTypes stage, IServiceProvider serviceProvider)
   at Jellyfin.Server.Program.StartServer(IServerApplicationPaths appPaths, StartupOptions options, IConfiguration startupConfig)
[11:07:23] [ERR] [7] Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService: Health check StartupCheck with status Unhealthy completed after 0.0473ms with message 'Server is could not complete startup. Check logs.'

FFmpeg logs


Client / Browser logs

No response

Relevant screenshots or videos

No response

Additional information

No response

Originally created by @lutzbat on GitHub (Sep 25, 2025). ### Description of the bug I wanted to upgrade for testing from version 10.10.7 to 10.11.0 RC6 but the startup migration throws an 'FOREIGN KEY constraint failed' error on saving ItemValues. Before I updated, I removed all Plugins from the UI and the plugins folder, if that's relevant. ### Reproduction steps I can reproduce this behavior by replacing the config folder with a backup I made from version 10.10.7 and attempt to upgrade to 10.11.0 RC6 again. ### What is the current _bug_ behavior? Database migration throws an error and therefore does not successfully migrate. ### What is the expected _correct_ behavior? Database migration successfully migrate the current database to the new EFCore database. ### Jellyfin Server version Master ### Specify commit id 2aa39226c6f47a7d985bd1f5ddc887387650daad ### Specify unstable release number _No response_ ### Specify version number _No response_ ### Specify the build version Can not get into the dashboard ### Environment ```markdown - OS: Ubuntu 24.04.3 - Linux Kernel: 6.8.0 - Virtualization: Docker - Reverse Proxy: traefik - Base URL: none - Networking: Bridge - Jellyfin Data Storage: local SSD - Media Storage: local HDD ``` ### Jellyfin logs ```shell [11:06:51] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Cleanup database [11:06:51] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Cleanup database took '00:00:00.0182432' [11:06:51] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Moving TypedBaseItem [11:06:51] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Loading TypedBaseItems [11:06:53] [WRN] [12] Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService: Health check StartupCheck with status Degraded completed after 0.6638ms with message 'Server is still starting up.' [11:06:56] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Loading TypedBaseItems took '00:00:05.3233864' [11:06:56] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Clean TypedBaseItems hierarchy [11:06:58] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Clean TypedBaseItems hierarchy took '00:00:01.8507991' [11:06:58] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Saving 38165 BaseItem entries [11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Saving 38165 BaseItem entries took '00:00:13.7594974' [11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Moving TypedBaseItem took '00:00:20.9621546' [11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Moving ItemValues [11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Loading ItemValues [11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Loading ItemValues took '00:00:00.1555740' [11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Start Saving 4693 ItemValues entries [11:07:12] [ERR] [7] Microsoft.EntityFrameworkCore.Database.Command: Failed executing DbCommand (1ms) [Parameters=[@p0='?' (DbType = Guid), @p1='?' (DbType = Guid)], CommandType='Text', CommandTimeout='30'] INSERT INTO "ItemValuesMap" ("ItemId", "ItemValueId") VALUES (@p0, @p1); SELECT changes(); [11:07:12] [ERR] [7] Microsoft.EntityFrameworkCore.Update: An exception occurred in the database while saving changes for context type 'Jellyfin.Database.Implementations.JellyfinDbContext'. Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'. at Microsoft.Data.Sqlite.SqliteDataReader.NextResult() at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection) --- End of inner exception stack trace --- at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t) at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess) Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'. at Microsoft.Data.Sqlite.SqliteDataReader.NextResult() at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection) --- End of inner exception stack trace --- at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t) at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess) [11:07:12] [ERR] [7] Jellyfin.Database.Implementations.JellyfinDbContext: Error trying to save changes. Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'. at Microsoft.Data.Sqlite.SqliteDataReader.NextResult() at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection) --- End of inner exception stack trace --- at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t) at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess) at Jellyfin.Database.Implementations.JellyfinDbContext.<>n__1(Boolean acceptAllChangesOnSuccess) at Jellyfin.Database.Implementations.JellyfinDbContext.<>c__DisplayClass63_1.<SaveChanges>b__0() at Jellyfin.Database.Implementations.Locking.NoLockBehavior.OnSaveChanges(JellyfinDbContext context, Action saveChanges) at Jellyfin.Database.Implementations.JellyfinDbContext.SaveChanges(Boolean acceptAllChangesOnSuccess) [11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Saving 4693 ItemValues entries took '00:00:00.2923893' [11:07:12] [INF] [7] Jellyfin.Server.Migrations.Routines.MigrateLibraryDb: Moving ItemValues took '00:00:00.4509929' [11:07:12] [FTL] [7] InternalCodeMigration: Error: An error occurred while saving the entity changes. See the inner exception for details. [11:07:12] [ERR] [7] InternalCodeMigration: Migration 20250420200000_MigrateLibraryDb failed Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'. at Microsoft.Data.Sqlite.SqliteDataReader.NextResult() at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection) --- End of inner exception stack trace --- at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t) at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess) at Jellyfin.Database.Implementations.JellyfinDbContext.<>n__1(Boolean acceptAllChangesOnSuccess) at Jellyfin.Database.Implementations.JellyfinDbContext.<>c__DisplayClass63_1.<SaveChanges>b__0() at Jellyfin.Database.Implementations.Locking.NoLockBehavior.OnSaveChanges(JellyfinDbContext context, Action saveChanges) at Jellyfin.Database.Implementations.JellyfinDbContext.SaveChanges(Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.DbContext.SaveChanges() at Jellyfin.Server.Migrations.Routines.MigrateLibraryDb.Perform() at Jellyfin.Server.Migrations.Stages.CodeMigration.Perform(IServiceProvider serviceProvider, IStartupLogger logger, CancellationToken cancellationToken) at Jellyfin.Server.Migrations.JellyfinMigrationService.InternalCodeMigration.PerformAsync(IStartupLogger logger) at Jellyfin.Server.Migrations.JellyfinMigrationService.MigrateStepAsync(JellyfinMigrationStageTypes stage, IServiceProvider serviceProvider) [11:07:12] [INF] [7] InternalCodeMigration: Attempt to rollback librarydb. [11:07:12] [INF] [7] InternalCodeMigration: Attempt to rollback JellyfinDb. [11:07:12] [FTL] [7] Main: Error while starting server Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'FOREIGN KEY constraint failed'. at Microsoft.Data.Sqlite.SqliteDataReader.NextResult() at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection) --- End of inner exception stack trace --- at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t) at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess) at Jellyfin.Database.Implementations.JellyfinDbContext.<>n__1(Boolean acceptAllChangesOnSuccess) at Jellyfin.Database.Implementations.JellyfinDbContext.<>c__DisplayClass63_1.<SaveChanges>b__0() at Jellyfin.Database.Implementations.Locking.NoLockBehavior.OnSaveChanges(JellyfinDbContext context, Action saveChanges) at Jellyfin.Database.Implementations.JellyfinDbContext.SaveChanges(Boolean acceptAllChangesOnSuccess) at Microsoft.EntityFrameworkCore.DbContext.SaveChanges() at Jellyfin.Server.Migrations.Routines.MigrateLibraryDb.Perform() at Jellyfin.Server.Migrations.Stages.CodeMigration.Perform(IServiceProvider serviceProvider, IStartupLogger logger, CancellationToken cancellationToken) at Jellyfin.Server.Migrations.JellyfinMigrationService.InternalCodeMigration.PerformAsync(IStartupLogger logger) at Jellyfin.Server.Migrations.JellyfinMigrationService.MigrateStepAsync(JellyfinMigrationStageTypes stage, IServiceProvider serviceProvider) at Jellyfin.Server.Migrations.JellyfinMigrationService.MigrateStepAsync(JellyfinMigrationStageTypes stage, IServiceProvider serviceProvider) at Jellyfin.Server.Migrations.JellyfinMigrationService.MigrateStepAsync(JellyfinMigrationStageTypes stage, IServiceProvider serviceProvider) at Jellyfin.Server.Program.StartServer(IServerApplicationPaths appPaths, StartupOptions options, IConfiguration startupConfig) [11:07:23] [ERR] [7] Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService: Health check StartupCheck with status Unhealthy completed after 0.0473ms with message 'Server is could not complete startup. Check logs.' ``` ### FFmpeg logs ```shell ``` ### Client / Browser logs _No response_ ### Relevant screenshots or videos _No response_ ### Additional information _No response_
OVERLORD added the bug label 2026-02-07 04:51:17 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#7349