[10.11.1] Migrating userdata fails #7618

Closed
opened 2026-02-07 05:15:06 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @BartvandenHout on GitHub (Oct 28, 2025).

Description of the bug

Migration from 10.10.7 to 10.11.1 fails with userdata from library.db.old
Can't find users with certain indexes:
Tried to find user with index '4' but there are only '12' users.
Tried to find user with index '5' but there are only '12' users.
Tried to find user with index '10' but there are only '12' users.
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

Upgrade with apt from current 10.10.7 to 10.11.1

What is the current bug behavior?

Migration fails

What is the expected correct behavior?

Migration finishes

Jellyfin Server version

10.10.0+

Specify commit id

No response

Specify unstable release number

No response

Specify version number

10.10.7

Specify the build version

10.10.7

Environment

- OS: Ubuntu 24.04
- Linux Kernel: 6.8.0-86-generic x86_64
- Virtualization:
- Clients:
- Browser:
- FFmpeg Version:
- Playback Method:
- Hardware Acceleration:
- GPU Model:
- Plugins:
- Reverse Proxy:
- Base URL:
- Networking:
- Jellyfin Data Storage:
- Media Storage:
- External Integrations:

Jellyfin logs

...
[2025-10-28 16:31:13.476 +01:00] [INF] There are 11 migrations for stage AppInitialisation.
[2025-10-28 16:31:13.476 +01:00] [INF] Perform migration "20250420193000_MigrateLibraryDbCompatibilityCheck"
[2025-10-28 16:31:13.482 +01:00] [INF] Migration "20250420193000_MigrateLibraryDbCompatibilityCheck" was successfully applied
[2025-10-28 16:31:13.482 +01:00] [INF] Perform migration "20250420200000_MigrateLibraryDb"
[2025-10-28 16:31:13.487 +01:00] [INF] Migrating the userdata from library.db may take a while, do not stop Jellyfin.
[2025-10-28 16:31:13.530 +01:00] [INF] Start "Cleanup database"
[2025-10-28 16:31:13.554 +01:00] [INF] "Cleanup database" took '00:00:00.0237627'
[2025-10-28 16:31:13.556 +01:00] [INF] Start "Moving TypedBaseItem"
[2025-10-28 16:31:13.556 +01:00] [INF] Start "Loading TypedBaseItems"
[2025-10-28 16:31:17.158 +01:00] [INF] "Loading TypedBaseItems" took '00:00:03.6020247'
[2025-10-28 16:31:17.158 +01:00] [INF] Start "Clean TypedBaseItems hierarchy"
[2025-10-28 16:31:19.676 +01:00] [INF] "Clean TypedBaseItems hierarchy" took '00:00:02.5184618'
[2025-10-28 16:31:19.691 +01:00] [INF] Start "Saving 21082 BaseItem entries"
[2025-10-28 16:31:30.495 +01:00] [INF] "Saving 21082 BaseItem entries" took '00:00:10.8038758'
[2025-10-28 16:31:30.497 +01:00] [INF] "Moving TypedBaseItem" took '00:00:16.9412330'
[2025-10-28 16:31:30.497 +01:00] [INF] Start "Moving ItemValues"
[2025-10-28 16:31:30.497 +01:00] [INF] Start "Loading ItemValues"
[2025-10-28 16:31:30.760 +01:00] [INF] "Loading ItemValues" took '00:00:00.2625867'
[2025-10-28 16:31:30.763 +01:00] [INF] Start "Saving 5644 ItemValues entries"
[2025-10-28 16:31:32.045 +01:00] [INF] "Saving 5644 ItemValues entries" took '00:00:01.2824736'
[2025-10-28 16:31:32.046 +01:00] [INF] "Moving ItemValues" took '00:00:01.5490176'
[2025-10-28 16:31:32.046 +01:00] [INF] Start "Moving UserData"
[2025-10-28 16:31:32.046 +01:00] [INF] Start "Loading UserData"
[2025-10-28 16:31:32.055 +01:00] [ERR] Tried to find user with index '4' but there are only '12' users.
[2025-10-28 16:31:32.126 +01:00] [ERR] Tried to find user with index '10' but there are only '12' users.
[2025-10-28 16:31:32.172 +01:00] [INF] "Loading UserData" took '00:00:00.1259342'
[2025-10-28 16:31:32.173 +01:00] [INF] Start "Saving 4170 UserData entries"
[2025-10-28 16:31:32.550 +01:00] [INF] "Saving 4170 UserData entries" took '00:00:00.3767524'
[2025-10-28 16:31:32.550 +01:00] [INF] "Moving UserData" took '00:00:00.5042664'
[2025-10-28 16:31:32.550 +01:00] [INF] Start "Moving MediaStreamInfos"
[2025-10-28 16:31:32.550 +01:00] [INF] Start "Loading MediaStreamInfos"
[2025-10-28 16:31:33.946 +01:00] [INF] "Loading MediaStreamInfos" took '00:00:01.3955880'
[2025-10-28 16:31:33.950 +01:00] [INF] Start "Saving 53987 MediaStreamInfos entries"
[2025-10-28 16:31:42.466 +01:00] [INF] "Saving 53987 MediaStreamInfos entries" took '00:00:08.5155669'
[2025-10-28 16:31:42.466 +01:00] [INF] "Moving MediaStreamInfos" took '00:00:09.9158337'
[2025-10-28 16:31:42.466 +01:00] [INF] Start "Moving AttachmentStreamInfos"
[2025-10-28 16:31:42.466 +01:00] [INF] Start "Loading AttachmentStreamInfos"
[2025-10-28 16:31:42.478 +01:00] [INF] "Loading AttachmentStreamInfos" took '00:00:00.0116565'
[2025-10-28 16:31:42.478 +01:00] [INF] Start "Saving 48 AttachmentStreamInfos entries"
[2025-10-28 16:31:42.485 +01:00] [INF] "Saving 48 AttachmentStreamInfos entries" took '00:00:00.0064902'
[2025-10-28 16:31:42.485 +01:00] [INF] "Moving AttachmentStreamInfos" took '00:00:00.0186916'
[2025-10-28 16:31:42.485 +01:00] [INF] Start "Moving People"
[2025-10-28 16:31:42.485 +01:00] [INF] Start "Loading People"
[2025-10-28 16:31:43.042 +01:00] [INF] "Loading People" took '00:00:00.5571559'
[2025-10-28 16:31:43.050 +01:00] [INF] Start "Saving 17966 People entries and 29575 maps"
[2025-10-28 16:31:46.032 +01:00] [INF] "Saving 17966 People entries and 29575 maps" took '00:00:02.9812320'
[2025-10-28 16:31:46.032 +01:00] [INF] "Moving People" took '00:00:03.5470060'
[2025-10-28 16:31:46.032 +01:00] [INF] Start "Moving Chapters"
[2025-10-28 16:31:46.032 +01:00] [INF] Start "Loading Chapters"
[2025-10-28 16:31:46.052 +01:00] [INF] "Loading Chapters" took '00:00:00.0195974'
[2025-10-28 16:31:46.052 +01:00] [INF] Start "Saving 0 Chapters entries"
[2025-10-28 16:31:46.052 +01:00] [INF] "Saving 0 Chapters entries" took '00:00:00.0001354'
[2025-10-28 16:31:46.052 +01:00] [INF] "Moving Chapters" took '00:00:00.0201995'
[2025-10-28 16:31:46.052 +01:00] [INF] Start "Moving AncestorIds"
[2025-10-28 16:31:46.052 +01:00] [INF] Start "Loading AncestorIds"
[2025-10-28 16:31:46.083 +01:00] [INF] "Loading AncestorIds" took '00:00:00.0309547'
[2025-10-28 16:31:46.084 +01:00] [INF] Start "Saving 0 AncestorId entries"
[2025-10-28 16:31:46.084 +01:00] [INF] "Saving 0 AncestorId entries" took '00:00:00.0000594'
[2025-10-28 16:31:46.084 +01:00] [INF] "Moving AncestorIds" took '00:00:00.0315334'
[2025-10-28 16:31:46.084 +01:00] [INF] Migration of the Library.db done.
[2025-10-28 16:31:46.084 +01:00] [INF] Migrating Library db took 00:00:32.5962095.
[2025-10-28 16:31:46.091 +01:00] [INF] Move "/var/lib/jellyfin/data/library.db" to "/var/lib/jellyfin/data/library.db.old".
[2025-10-28 16:31:46.094 +01:00] [INF] Migration "20250420200000_MigrateLibraryDb" was successfully applied
[2025-10-28 16:31:46.094 +01:00] [INF] Perform migration "20250420210000_MoveExtractedFiles"
[2025-10-28 16:31:46.124 +01:00] [INF] Checking 2869 items for movable extracted files.
[2025-10-28 16:31:46.129 +01:00] [INF] Checked: 0 - Moved: 0 - Time: 00:00:00.0316049
[2025-10-28 16:31:48.826 +01:00] [INF] Moved files for 0 items in 00:00:02.7291586
[2025-10-28 16:31:48.844 +01:00] [INF] Cleaned up left over subtitles and attachments.
[2025-10-28 16:31:48.844 +01:00] [INF] Migration "20250420210000_MoveExtractedFiles" was successfully applied
[2025-10-28 16:31:48.844 +01:00] [INF] Perform migration "20250420220000_MigrateRatingLevels"
[2025-10-28 16:31:48.846 +01:00] [INF] Recalculating parental rating levels based on rating string.
[2025-10-28 16:31:49.721 +01:00] [INF] Migration "20250420220000_MigrateRatingLevels" was successfully applied
[2025-10-28 16:31:49.721 +01:00] [INF] Perform migration "20250420230000_MoveTrickplayFiles"
[2025-10-28 16:31:49.923 +01:00] [INF] Checked: 5000 - Moved: 0 - Time: 00:00:00.1985253
[2025-10-28 16:31:49.923 +01:00] [INF] Moved 0 items in 00:00:00.1987675
[2025-10-28 16:31:49.924 +01:00] [INF] Migration "20250420230000_MoveTrickplayFiles" was successfully applied
[2025-10-28 16:31:49.924 +01:00] [INF] Perform migration "20250420230000_RefreshInternalDateModified"
[2025-10-28 16:31:49.932 +01:00] [INF] Checking if 1497 potentially internal items require refreshed DateModified
[2025-10-28 16:31:50.025 +01:00] [INF] Checked: 1497 - Refreshed: 1497 - Time: 00:00:00.0986128
[2025-10-28 16:31:50.810 +01:00] [INF] Refreshed DateModified for 1497 items in 00:00:00.8841099
[2025-10-28 16:31:50.811 +01:00] [INF] Disposing "CoreAppHost"
[2025-10-28 16:31:50.811 +01:00] [INF] Disposing "MusicBrainzArtistProvider"
[2025-10-28 16:31:50.812 +01:00] [INF] Disposing "MusicBrainzAlbumProvider"
[2025-10-28 16:31:50.812 +01:00] [INF] Disposing "PluginManager"
[2025-10-28 16:31:50.814 +01:00] [INF] Migration "20250420230000_RefreshInternalDateModified" was successfully applied
[2025-10-28 16:31:50.814 +01:00] [INF] Perform migration "20250421000000_MigrateKeyframeData"
[2025-10-28 16:31:50.825 +01:00] [INF] Checking 2869 items for importable keyframe data.
[2025-10-28 16:31:50.872 +01:00] [INF] Checked: 2869 - Imported: 0 - Time: 00:00:00.0555059
[2025-10-28 16:31:50.872 +01:00] [INF] Imported keyframes for 0 items in 00:00:00.0557427
[2025-10-28 16:31:50.872 +01:00] [INF] Migration "20250421000000_MigrateKeyframeData" was successfully applied
[2025-10-28 16:31:50.873 +01:00] [INF] Perform migration "20250618010000_MigrateLibraryUserData"
[2025-10-28 16:31:50.876 +01:00] [INF] Migrating the userdata from library.db.old may take a while, do not stop Jellyfin.
[2025-10-28 16:31:50.912 +01:00] [ERR] Tried to find user with index '4' but there are only '12' users.
[2025-10-28 16:31:50.956 +01:00] [ERR] Tried to find user with index '5' but there are only '12' users.
[2025-10-28 16:31:50.995 +01:00] [ERR] Tried to find user with index '10' but there are only '12' users.
[2025-10-28 16:31:52.452 +01:00] [FTL] 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."
[2025-10-28 16:31:52.452 +01:00] [ERR] Migration "20250618010000_MigrateLibraryUserData" failed
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.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)
[2025-10-28 16:31:52.459 +01:00] [INF] Attempt to rollback librarydb.
[2025-10-28 16:31:52.459 +01:00] [INF] Attempt to rollback JellyfinDb.
[2025-10-28 16:31:52.878 +01:00] [FTL] 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.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)

FFmpeg logs


Client / Browser logs

No response

Relevant screenshots or videos

No response

Additional information

No response

Originally created by @BartvandenHout on GitHub (Oct 28, 2025). ### Description of the bug Migration from 10.10.7 to 10.11.1 fails with userdata from library.db.old Can't find users with certain indexes: Tried to find user with index '4' but there are only '12' users. Tried to find user with index '5' but there are only '12' users. Tried to find user with index '10' but there are only '12' users. 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 Upgrade with apt from current 10.10.7 to 10.11.1 ### What is the current _bug_ behavior? Migration fails ### What is the expected _correct_ behavior? Migration finishes ### Jellyfin Server version 10.10.0+ ### Specify commit id _No response_ ### Specify unstable release number _No response_ ### Specify version number 10.10.7 ### Specify the build version 10.10.7 ### Environment ```markdown - OS: Ubuntu 24.04 - Linux Kernel: 6.8.0-86-generic x86_64 - Virtualization: - Clients: - Browser: - FFmpeg Version: - Playback Method: - Hardware Acceleration: - GPU Model: - Plugins: - Reverse Proxy: - Base URL: - Networking: - Jellyfin Data Storage: - Media Storage: - External Integrations: ``` ### Jellyfin logs ```shell ... [2025-10-28 16:31:13.476 +01:00] [INF] There are 11 migrations for stage AppInitialisation. [2025-10-28 16:31:13.476 +01:00] [INF] Perform migration "20250420193000_MigrateLibraryDbCompatibilityCheck" [2025-10-28 16:31:13.482 +01:00] [INF] Migration "20250420193000_MigrateLibraryDbCompatibilityCheck" was successfully applied [2025-10-28 16:31:13.482 +01:00] [INF] Perform migration "20250420200000_MigrateLibraryDb" [2025-10-28 16:31:13.487 +01:00] [INF] Migrating the userdata from library.db may take a while, do not stop Jellyfin. [2025-10-28 16:31:13.530 +01:00] [INF] Start "Cleanup database" [2025-10-28 16:31:13.554 +01:00] [INF] "Cleanup database" took '00:00:00.0237627' [2025-10-28 16:31:13.556 +01:00] [INF] Start "Moving TypedBaseItem" [2025-10-28 16:31:13.556 +01:00] [INF] Start "Loading TypedBaseItems" [2025-10-28 16:31:17.158 +01:00] [INF] "Loading TypedBaseItems" took '00:00:03.6020247' [2025-10-28 16:31:17.158 +01:00] [INF] Start "Clean TypedBaseItems hierarchy" [2025-10-28 16:31:19.676 +01:00] [INF] "Clean TypedBaseItems hierarchy" took '00:00:02.5184618' [2025-10-28 16:31:19.691 +01:00] [INF] Start "Saving 21082 BaseItem entries" [2025-10-28 16:31:30.495 +01:00] [INF] "Saving 21082 BaseItem entries" took '00:00:10.8038758' [2025-10-28 16:31:30.497 +01:00] [INF] "Moving TypedBaseItem" took '00:00:16.9412330' [2025-10-28 16:31:30.497 +01:00] [INF] Start "Moving ItemValues" [2025-10-28 16:31:30.497 +01:00] [INF] Start "Loading ItemValues" [2025-10-28 16:31:30.760 +01:00] [INF] "Loading ItemValues" took '00:00:00.2625867' [2025-10-28 16:31:30.763 +01:00] [INF] Start "Saving 5644 ItemValues entries" [2025-10-28 16:31:32.045 +01:00] [INF] "Saving 5644 ItemValues entries" took '00:00:01.2824736' [2025-10-28 16:31:32.046 +01:00] [INF] "Moving ItemValues" took '00:00:01.5490176' [2025-10-28 16:31:32.046 +01:00] [INF] Start "Moving UserData" [2025-10-28 16:31:32.046 +01:00] [INF] Start "Loading UserData" [2025-10-28 16:31:32.055 +01:00] [ERR] Tried to find user with index '4' but there are only '12' users. [2025-10-28 16:31:32.126 +01:00] [ERR] Tried to find user with index '10' but there are only '12' users. [2025-10-28 16:31:32.172 +01:00] [INF] "Loading UserData" took '00:00:00.1259342' [2025-10-28 16:31:32.173 +01:00] [INF] Start "Saving 4170 UserData entries" [2025-10-28 16:31:32.550 +01:00] [INF] "Saving 4170 UserData entries" took '00:00:00.3767524' [2025-10-28 16:31:32.550 +01:00] [INF] "Moving UserData" took '00:00:00.5042664' [2025-10-28 16:31:32.550 +01:00] [INF] Start "Moving MediaStreamInfos" [2025-10-28 16:31:32.550 +01:00] [INF] Start "Loading MediaStreamInfos" [2025-10-28 16:31:33.946 +01:00] [INF] "Loading MediaStreamInfos" took '00:00:01.3955880' [2025-10-28 16:31:33.950 +01:00] [INF] Start "Saving 53987 MediaStreamInfos entries" [2025-10-28 16:31:42.466 +01:00] [INF] "Saving 53987 MediaStreamInfos entries" took '00:00:08.5155669' [2025-10-28 16:31:42.466 +01:00] [INF] "Moving MediaStreamInfos" took '00:00:09.9158337' [2025-10-28 16:31:42.466 +01:00] [INF] Start "Moving AttachmentStreamInfos" [2025-10-28 16:31:42.466 +01:00] [INF] Start "Loading AttachmentStreamInfos" [2025-10-28 16:31:42.478 +01:00] [INF] "Loading AttachmentStreamInfos" took '00:00:00.0116565' [2025-10-28 16:31:42.478 +01:00] [INF] Start "Saving 48 AttachmentStreamInfos entries" [2025-10-28 16:31:42.485 +01:00] [INF] "Saving 48 AttachmentStreamInfos entries" took '00:00:00.0064902' [2025-10-28 16:31:42.485 +01:00] [INF] "Moving AttachmentStreamInfos" took '00:00:00.0186916' [2025-10-28 16:31:42.485 +01:00] [INF] Start "Moving People" [2025-10-28 16:31:42.485 +01:00] [INF] Start "Loading People" [2025-10-28 16:31:43.042 +01:00] [INF] "Loading People" took '00:00:00.5571559' [2025-10-28 16:31:43.050 +01:00] [INF] Start "Saving 17966 People entries and 29575 maps" [2025-10-28 16:31:46.032 +01:00] [INF] "Saving 17966 People entries and 29575 maps" took '00:00:02.9812320' [2025-10-28 16:31:46.032 +01:00] [INF] "Moving People" took '00:00:03.5470060' [2025-10-28 16:31:46.032 +01:00] [INF] Start "Moving Chapters" [2025-10-28 16:31:46.032 +01:00] [INF] Start "Loading Chapters" [2025-10-28 16:31:46.052 +01:00] [INF] "Loading Chapters" took '00:00:00.0195974' [2025-10-28 16:31:46.052 +01:00] [INF] Start "Saving 0 Chapters entries" [2025-10-28 16:31:46.052 +01:00] [INF] "Saving 0 Chapters entries" took '00:00:00.0001354' [2025-10-28 16:31:46.052 +01:00] [INF] "Moving Chapters" took '00:00:00.0201995' [2025-10-28 16:31:46.052 +01:00] [INF] Start "Moving AncestorIds" [2025-10-28 16:31:46.052 +01:00] [INF] Start "Loading AncestorIds" [2025-10-28 16:31:46.083 +01:00] [INF] "Loading AncestorIds" took '00:00:00.0309547' [2025-10-28 16:31:46.084 +01:00] [INF] Start "Saving 0 AncestorId entries" [2025-10-28 16:31:46.084 +01:00] [INF] "Saving 0 AncestorId entries" took '00:00:00.0000594' [2025-10-28 16:31:46.084 +01:00] [INF] "Moving AncestorIds" took '00:00:00.0315334' [2025-10-28 16:31:46.084 +01:00] [INF] Migration of the Library.db done. [2025-10-28 16:31:46.084 +01:00] [INF] Migrating Library db took 00:00:32.5962095. [2025-10-28 16:31:46.091 +01:00] [INF] Move "/var/lib/jellyfin/data/library.db" to "/var/lib/jellyfin/data/library.db.old". [2025-10-28 16:31:46.094 +01:00] [INF] Migration "20250420200000_MigrateLibraryDb" was successfully applied [2025-10-28 16:31:46.094 +01:00] [INF] Perform migration "20250420210000_MoveExtractedFiles" [2025-10-28 16:31:46.124 +01:00] [INF] Checking 2869 items for movable extracted files. [2025-10-28 16:31:46.129 +01:00] [INF] Checked: 0 - Moved: 0 - Time: 00:00:00.0316049 [2025-10-28 16:31:48.826 +01:00] [INF] Moved files for 0 items in 00:00:02.7291586 [2025-10-28 16:31:48.844 +01:00] [INF] Cleaned up left over subtitles and attachments. [2025-10-28 16:31:48.844 +01:00] [INF] Migration "20250420210000_MoveExtractedFiles" was successfully applied [2025-10-28 16:31:48.844 +01:00] [INF] Perform migration "20250420220000_MigrateRatingLevels" [2025-10-28 16:31:48.846 +01:00] [INF] Recalculating parental rating levels based on rating string. [2025-10-28 16:31:49.721 +01:00] [INF] Migration "20250420220000_MigrateRatingLevels" was successfully applied [2025-10-28 16:31:49.721 +01:00] [INF] Perform migration "20250420230000_MoveTrickplayFiles" [2025-10-28 16:31:49.923 +01:00] [INF] Checked: 5000 - Moved: 0 - Time: 00:00:00.1985253 [2025-10-28 16:31:49.923 +01:00] [INF] Moved 0 items in 00:00:00.1987675 [2025-10-28 16:31:49.924 +01:00] [INF] Migration "20250420230000_MoveTrickplayFiles" was successfully applied [2025-10-28 16:31:49.924 +01:00] [INF] Perform migration "20250420230000_RefreshInternalDateModified" [2025-10-28 16:31:49.932 +01:00] [INF] Checking if 1497 potentially internal items require refreshed DateModified [2025-10-28 16:31:50.025 +01:00] [INF] Checked: 1497 - Refreshed: 1497 - Time: 00:00:00.0986128 [2025-10-28 16:31:50.810 +01:00] [INF] Refreshed DateModified for 1497 items in 00:00:00.8841099 [2025-10-28 16:31:50.811 +01:00] [INF] Disposing "CoreAppHost" [2025-10-28 16:31:50.811 +01:00] [INF] Disposing "MusicBrainzArtistProvider" [2025-10-28 16:31:50.812 +01:00] [INF] Disposing "MusicBrainzAlbumProvider" [2025-10-28 16:31:50.812 +01:00] [INF] Disposing "PluginManager" [2025-10-28 16:31:50.814 +01:00] [INF] Migration "20250420230000_RefreshInternalDateModified" was successfully applied [2025-10-28 16:31:50.814 +01:00] [INF] Perform migration "20250421000000_MigrateKeyframeData" [2025-10-28 16:31:50.825 +01:00] [INF] Checking 2869 items for importable keyframe data. [2025-10-28 16:31:50.872 +01:00] [INF] Checked: 2869 - Imported: 0 - Time: 00:00:00.0555059 [2025-10-28 16:31:50.872 +01:00] [INF] Imported keyframes for 0 items in 00:00:00.0557427 [2025-10-28 16:31:50.872 +01:00] [INF] Migration "20250421000000_MigrateKeyframeData" was successfully applied [2025-10-28 16:31:50.873 +01:00] [INF] Perform migration "20250618010000_MigrateLibraryUserData" [2025-10-28 16:31:50.876 +01:00] [INF] Migrating the userdata from library.db.old may take a while, do not stop Jellyfin. [2025-10-28 16:31:50.912 +01:00] [ERR] Tried to find user with index '4' but there are only '12' users. [2025-10-28 16:31:50.956 +01:00] [ERR] Tried to find user with index '5' but there are only '12' users. [2025-10-28 16:31:50.995 +01:00] [ERR] Tried to find user with index '10' but there are only '12' users. [2025-10-28 16:31:52.452 +01:00] [FTL] 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." [2025-10-28 16:31:52.452 +01:00] [ERR] Migration "20250618010000_MigrateLibraryUserData" failed 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.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) [2025-10-28 16:31:52.459 +01:00] [INF] Attempt to rollback librarydb. [2025-10-28 16:31:52.459 +01:00] [INF] Attempt to rollback JellyfinDb. [2025-10-28 16:31:52.878 +01:00] [FTL] 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.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) ``` ### 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 05:15:06 +03:00
Author
Owner

@BartvandenHout commented on GitHub (Oct 31, 2025):

I checked my database Users-table. My guess is that because I have had users deleted and therefor 'user index' jumps from 3 to 7 and from 9 to 11.
Could this be the cause of errors?

@BartvandenHout commented on GitHub (Oct 31, 2025): I checked my database Users-table. My guess is that because I have had users deleted and therefor 'user index' jumps from 3 to 7 and from 9 to 11. Could this be the cause of errors?
Author
Owner

@JoeGandy commented on GitHub (Oct 31, 2025):

I'm having the same issue

@JoeGandy commented on GitHub (Oct 31, 2025): I'm having the same issue
Author
Owner

@BartvandenHout commented on GitHub (Nov 1, 2025):

Extra information: seems to me the "Tried to find user with index 'x' but there are only 'x' users."-errors are logged when building the userIdBlacklist (in MigrateLibraryDb.cs > GetUserData), which should be happening and is correctly done for id's 4, 5 and 10. But for some reason it's not added id 6 to userIdBlacklist, which is also NOT in my Users anymore.

PS. I don't know if this info is helpful or just more and unnecessary extra read. Sorry if its the latter.

@BartvandenHout commented on GitHub (Nov 1, 2025): Extra information: seems to me the "Tried to find user with index 'x' but there are only 'x' users."-errors are logged when building the userIdBlacklist (in MigrateLibraryDb.cs > GetUserData), which should be happening and is correctly done for id's 4, 5 and 10. But for some reason it's not added id 6 to userIdBlacklist, which is also NOT in my Users anymore. PS. I don't know if this info is helpful or just more and unnecessary extra read. Sorry if its the latter.
Author
Owner

@stignarnia commented on GitHub (Nov 10, 2025):

I have the same issue, plus also an issue with Error: "The instance of entity type 'MediaStreamInfo'"

@stignarnia commented on GitHub (Nov 10, 2025): I have the same issue, plus also an issue with `Error: "The instance of entity type 'MediaStreamInfo'"`
Author
Owner

@Jerrys-modz commented on GitHub (Nov 17, 2025):

Hi any update to this? I am having the same issue

@Jerrys-modz commented on GitHub (Nov 17, 2025): Hi any update to this? I am having the same issue
Author
Owner

@BartvandenHout commented on GitHub (Jan 5, 2026):

This fixed it for me, too:
https://github.com/jellyfin/jellyfin/issues/15147#issuecomment-3568095591

@BartvandenHout commented on GitHub (Jan 5, 2026): This fixed it for me, too: https://github.com/jellyfin/jellyfin/issues/15147#issuecomment-3568095591
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#7618