migration from 10.10.7 to 10.11 failed - related to entity type 'UserData' #7471

Closed
opened 2026-02-07 05:02:23 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @kambala-decapitator on GitHub (Oct 21, 2025).

Description of the bug

DB migration fails with

Error: The instance of entity type 'UserData' cannot be tracked because another instance with the same key value for {'ItemId', 'UserId', 'CustomDataKey'} is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values.

Reproduction steps

apt upgrade jellyfin

What is the current bug behavior?

Jellyfin doesn't start

What is the expected correct behavior?

Migration succeeds, Jellyfin starts

Jellyfin Server version

10.10.0+

Specify commit id

No response

Specify unstable release number

No response

Specify version number

10.11

Specify the build version

release from the debian 13 repo

Environment

- OS: Debian 13.1 x86_64
- Linux Kernel: 6.12.48+deb13-amd64
- Virtualization: -
- Clients: Jellyfin macOS app, browser
- Browser: Safari 26
- FFmpeg Version: jellyfin-ffmpeg7 (7.1.2-3-trixie)
- Playback Method: -
- Hardware Acceleration: -
- GPU Model: -
- Plugins: TMDb, Studio Images, OMDb, MusicBrainz, AudioDB
- Reverse Proxy: -
- Base URL: -
- Networking: LAN
- Jellyfin Data Storage: local HDD
- Media Storage: external USB HDD
- External Integrations: -

Jellyfin logs

log of the first upgrade attempt: https://github.com/jellyfin/jellyfin/issues/15027#issuecomment-3425510048

another attempt with the same error: jellyfin.log

log of another user with the same error: https://github.com/jellyfin/jellyfin/issues/15027#issuecomment-3422648320

FFmpeg logs


Client / Browser logs

No response

Relevant screenshots or videos

No response

Additional information

A few days ago I migrated my data from a Debian 11 server running Jellyfin 10.9.9 to the current Debian 13 server running 10.10.7, 10.10.7 has been functioning perfectly.

Originally created by @kambala-decapitator on GitHub (Oct 21, 2025). ### Description of the bug DB migration fails with > Error: The instance of entity type 'UserData' cannot be tracked because another instance with the same key value for {'ItemId', 'UserId', 'CustomDataKey'} is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values. ### Reproduction steps apt upgrade jellyfin ### What is the current _bug_ behavior? Jellyfin doesn't start ### What is the expected _correct_ behavior? Migration succeeds, Jellyfin starts ### Jellyfin Server version 10.10.0+ ### Specify commit id _No response_ ### Specify unstable release number _No response_ ### Specify version number 10.11 ### Specify the build version release from the debian 13 repo ### Environment ```markdown - OS: Debian 13.1 x86_64 - Linux Kernel: 6.12.48+deb13-amd64 - Virtualization: - - Clients: Jellyfin macOS app, browser - Browser: Safari 26 - FFmpeg Version: jellyfin-ffmpeg7 (7.1.2-3-trixie) - Playback Method: - - Hardware Acceleration: - - GPU Model: - - Plugins: TMDb, Studio Images, OMDb, MusicBrainz, AudioDB - Reverse Proxy: - - Base URL: - - Networking: LAN - Jellyfin Data Storage: local HDD - Media Storage: external USB HDD - External Integrations: - ``` ### Jellyfin logs log of the first upgrade attempt: https://github.com/jellyfin/jellyfin/issues/15027#issuecomment-3425510048 another attempt with the same error: [jellyfin.log](https://github.com/user-attachments/files/23019988/jellyfin.log) log of another user with the same error: https://github.com/jellyfin/jellyfin/issues/15027#issuecomment-3422648320 ### FFmpeg logs ```shell ``` ### Client / Browser logs _No response_ ### Relevant screenshots or videos _No response_ ### Additional information A few days ago I migrated my data from a Debian 11 server running Jellyfin 10.9.9 to the current Debian 13 server running 10.10.7, 10.10.7 has been functioning perfectly.
OVERLORD added the bug label 2026-02-07 05:02:23 +03:00
Author
Owner

@kambala-decapitator commented on GitHub (Oct 21, 2025):

@seebaer1976 you can track your migration issue here

@kambala-decapitator commented on GitHub (Oct 21, 2025): @seebaer1976 you can track your migration issue here
Author
Owner

@sanimalp commented on GitHub (Oct 25, 2025):

I see this same bug after upgrading using the .deb from 10.9.x -> 10.11. My instance does start but it is very laggy loading the home screen for a user.

In my case, i see this log when trying to mark a "next up" episode as watched on an episode that i watched prior to the upgrade.

@sanimalp commented on GitHub (Oct 25, 2025): I see this same bug after upgrading using the .deb from 10.9.x -> 10.11. My instance does start but it is very laggy loading the home screen for a user. In my case, i see this log when trying to mark a "next up" episode as watched on an episode that i watched prior to the upgrade.
Author
Owner

@charlesangus commented on GitHub (Nov 19, 2025):

Seeing this issue upgrading from 10.10.7 to 10.11.3. Using official Docker image.

[00:05:20] [INF] [9] InternalCodeMigration: Attempt to rollback librarydb.
[00:05:20] [INF] [9] InternalCodeMigration: Attempt to rollback JellyfinDb.
[00:05:20] [FTL] [9] Main: Error while starting server
System.InvalidOperationException: The instance of entity type 'UserData' cannot be tracked because another instance with the same key value for {'ItemId', 'UserId', 'CustomDataKey'} is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values.
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IdentityMap`1.ThrowIdentityConflict(InternalEntityEntry entry)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IdentityMap`1.Add(TKey key, InternalEntityEntry entry, Boolean updateDuplicate)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTracking(InternalEntityEntry entry)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState oldState, EntityState newState, Boolean acceptChanges, Boolean modifyProperties)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState entityState, Boolean acceptChanges, Boolean modifyProperties, Nullable`1 forceStateWhenUnknownKey, Nullable`1 fallbackState)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.PaintAction(EntityEntryGraphNode`1 node)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState](EntityEntryGraphNode`1 node, Func`2 handleNode)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.AttachGraph(InternalEntityEntry rootEntry, EntityState targetState, EntityState storeGeneratedWithKeySetTargetState, Boolean forceStateWhenUnknownKey)
   at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.SetEntityStates(IEnumerable`1 entities, EntityState entityState)
   at Jellyfin.Server.Migrations.Routines.MigrateLibraryUserData.PerformAsync(CancellationToken cancellationToken)
   at Jellyfin.Server.Migrations.Routines.MigrateLibraryUserData.PerformAsync(CancellationToken cancellationToken)
   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)

It is also not possible to roll back cleanly to 10.10.7 after this happens.

@charlesangus commented on GitHub (Nov 19, 2025): Seeing this issue upgrading from 10.10.7 to 10.11.3. Using official Docker image. ``` [00:05:20] [INF] [9] InternalCodeMigration: Attempt to rollback librarydb. [00:05:20] [INF] [9] InternalCodeMigration: Attempt to rollback JellyfinDb. [00:05:20] [FTL] [9] Main: Error while starting server System.InvalidOperationException: The instance of entity type 'UserData' cannot be tracked because another instance with the same key value for {'ItemId', 'UserId', 'CustomDataKey'} is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values. at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IdentityMap`1.ThrowIdentityConflict(InternalEntityEntry entry) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IdentityMap`1.Add(TKey key, InternalEntityEntry entry, Boolean updateDuplicate) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTracking(InternalEntityEntry entry) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState oldState, EntityState newState, Boolean acceptChanges, Boolean modifyProperties) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState entityState, Boolean acceptChanges, Boolean modifyProperties, Nullable`1 forceStateWhenUnknownKey, Nullable`1 fallbackState) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.PaintAction(EntityEntryGraphNode`1 node) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState](EntityEntryGraphNode`1 node, Func`2 handleNode) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.AttachGraph(InternalEntityEntry rootEntry, EntityState targetState, EntityState storeGeneratedWithKeySetTargetState, Boolean forceStateWhenUnknownKey) at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.SetEntityStates(IEnumerable`1 entities, EntityState entityState) at Jellyfin.Server.Migrations.Routines.MigrateLibraryUserData.PerformAsync(CancellationToken cancellationToken) at Jellyfin.Server.Migrations.Routines.MigrateLibraryUserData.PerformAsync(CancellationToken cancellationToken) 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) ``` It is also not possible to roll back cleanly to 10.10.7 after this happens.
Author
Owner

@kambala-decapitator commented on GitHub (Nov 22, 2025):

migration from 10.10.7 to 10.11.3 on Debian 13 x86_64 has been successful for me

@kambala-decapitator commented on GitHub (Nov 22, 2025): migration from 10.10.7 to 10.11.3 on Debian 13 x86_64 has been successful for me
Author
Owner

@charlesangus commented on GitHub (Nov 22, 2025):

Still an issue on Docker moving between those versions.

@charlesangus commented on GitHub (Nov 22, 2025): Still an issue on Docker moving between those versions.
Author
Owner

@charlesangus commented on GitHub (Nov 22, 2025):

This should remain open but I don't have permission to reopen it.

@charlesangus commented on GitHub (Nov 22, 2025): This should remain open but I don't have permission to reopen it.
Author
Owner

@kambala-decapitator commented on GitHub (Nov 22, 2025):

This should remain open but I don't have permission to reopen it.

just create new issue

@kambala-decapitator commented on GitHub (Nov 22, 2025): > This should remain open but I don't have permission to reopen it. just create new issue
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#7471