2 hours ago
This is my first foray into Jellyfin and I must be doing something wrong because when I delete a video from my harddrive nothing I do can get Jellyfin to remove the video from it's library, so I'm hoping some knowledgeable soul can point me in the right direction.
Context:
Installed latest Docker instance of Jellyfin, pointed it at a NAS with ReadOnly permissions. Initial scan worked fine but caused me to notice that at some point in the past I'd managed to end up with lots of duplicated videos. So I went through and sifted through all the duplicates removing the ones I didn't want and then re-scanned the library in the expectation that Jellyfin would remove the missing videos from my library and update the remaining records when I renamed things. Sadly no amount of re-scanning, restarting, or even removing the library and adding it back seemed to do so. I did have some success when deleting things one at a time via the Jellyfin UI, but have been to scared to test that in cases where I renamed the file but still wanted to keep it, as the prompt suggested it was going to try and delete the folder (even though it is supposed to be in Read Only mode). Ultimately I ended up deleting the entire container and starting over, which was fine up until I realized I'd missed some files. >.< So now I'm back here because I need to figure out how to work around this if I'm going to be able to use Jellyfin going forward.
When looking into the log file I see it complaining about "SQLite Error 19: 'UNIQUE constraint failed: UserData.ItemId, UserData.UserId, UserData.CustomDataKey'" But I'm not sure how I'm intended to prevent that in the first place, as the videos all follow pretty vanilla Radarr/Sonarr naming conventions. Full snippet of relevant logs below.
Context:
Installed latest Docker instance of Jellyfin, pointed it at a NAS with ReadOnly permissions. Initial scan worked fine but caused me to notice that at some point in the past I'd managed to end up with lots of duplicated videos. So I went through and sifted through all the duplicates removing the ones I didn't want and then re-scanned the library in the expectation that Jellyfin would remove the missing videos from my library and update the remaining records when I renamed things. Sadly no amount of re-scanning, restarting, or even removing the library and adding it back seemed to do so. I did have some success when deleting things one at a time via the Jellyfin UI, but have been to scared to test that in cases where I renamed the file but still wanted to keep it, as the prompt suggested it was going to try and delete the folder (even though it is supposed to be in Read Only mode). Ultimately I ended up deleting the entire container and starting over, which was fine up until I realized I'd missed some files. >.< So now I'm back here because I need to figure out how to work around this if I'm going to be able to use Jellyfin going forward.
When looking into the log file I see it complaining about "SQLite Error 19: 'UNIQUE constraint failed: UserData.ItemId, UserData.UserId, UserData.CustomDataKey'" But I'm not sure how I'm intended to prevent that in the first place, as the videos all follow pretty vanilla Radarr/Sonarr naming conventions. Full snippet of relevant logs below.
Quote:[2025-12-04 15:31:42.115 -08:00] [INF] [84] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Folder", Name: "Video I Legally Own (2014)", Path: "/movies/Video I Legally Own (2014)", Id: 02059e1f-3233-4f68-81c9-295efbfba677
[2025-12-04 15:31:42.123 -08:00] [ERR] [84] Microsoft.EntityFrameworkCore.Database.Command: Failed executing DbCommand ("0"ms) [Parameters=["@__date_1='?' (DbType = DateTime), @__p_0='?' (Size = 196)"], CommandType='Text', CommandTimeout='30']"
""UPDATE \"UserData\" AS \"u\"
SET \"ItemId\" = '00000000-0000-0000-0000-000000000001',
\"RetentionDate\" = @__date_1
WHERE \"u\".\"ItemId\" IN (
SELECT \"p\".\"value\"
FROM json_each(@__p_0) AS \"p\"
)"
[2025-12-04 15:31:42.124 -08:00] [ERR] [84] Microsoft.EntityFrameworkCore.Query: An exception occurred while executing an 'ExecuteUpdate' operation for context type '"Jellyfin.Database.Implementations.JellyfinDbContext"'."
""Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'UNIQUE constraint failed: UserData.ItemId, UserData.UserId, UserData.CustomDataKey'.
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.<>c.<NonQueryResult>b__31_0(DbContext _, ValueTuple3 state)3 state)
at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.NonQueryResult(RelationalQueryContext relationalQueryContext, RelationalCommandResolver relationalCommandResolver, Type contextType, CommandSource commandSource, Boolean threadSafetyChecksEnabled)"
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'UNIQUE constraint failed: UserData.ItemId, UserData.UserId, UserData.CustomDataKey'.
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.<>c.<NonQueryResult>b__31_0(DbContext _, ValueTuple
at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.NonQueryResult(RelationalQueryContext relationalQueryContext, RelationalCommandResolver relationalCommandResolver, Type contextType, CommandSource commandSource, Boolean threadSafetyChecksEnabled)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteCore[TResult](Expression query, Boolean async, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
at Jellyfin.Server.Implementations.Item.BaseItemRepository.DeleteItem(IReadOnlyList1 ids)1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
at Emby.Server.Implementations.Library.LibraryManager.DeleteItem(BaseItem item, DeleteOptions options, BaseItem parent, Boolean notifyParentItem)
at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal2(IProgress
[2025-12-04 15:31:42.124 -08:00] [ERR] [84] MediaBrowser.Controller.LibraryTaskScheduler.LimitedConcurrencyLibraryScheduler: Error while performing a library operation
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'UNIQUE constraint failed: UserData.ItemId, UserData.UserId, UserData.CustomDataKey'.
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.<>c.<NonQueryResult>b__31_0(DbContext _, ValueTuple3 state)1 ids)
at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.NonQueryResult(RelationalQueryContext relationalQueryContext, RelationalCommandResolver relationalCommandResolver, Type contextType, CommandSource commandSource, Boolean threadSafetyChecksEnabled)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteCore[TResult](Expression query, Boolean async, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
at Jellyfin.Server.Implementations.Item.BaseItemRepository.DeleteItem(IReadOnlyList
at Emby.Server.Implementations.Library.LibraryManager.DeleteItem(BaseItem item, DeleteOptions options, BaseItem parent, Boolean notifyParentItem)
at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal2(IProgress1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal(IProgress
at MediaBrowser.Controller.LibraryTaskScheduler.LimitedConcurrencyLibraryScheduler.ProcessItem(TaskQueueItem item)

