Jump to content

I've broken something :-( SQLiteException: FOREIGN KEY constraint failed


SirGanty

Recommended Posts

SirGanty
SQLitePCL.pretty.SQLiteException: Constraint: FOREIGN KEY constraint failed

My assumption is that one of my kids managed to rename my "Movies" folder on my mac a day or two back.

I looked in Emby and all of a sudden I was down to 3 movies (only those sourced from a non-standard location).

I looked in the filesystem and I noticed that my old movies folder was now callled "klasdk" or something similar, and still have all my movies in, but I now have a new folder (created a couple of days back), called "Movies", and with the same folder structure, but only containing an NFO for each of the previous movies.

I proceeded to delete the new movies folder (with the NFOs) and renamed the old one back...

ta-dah, my movies all appeared in emby again... yay!

except now none of them have metadata or images 😞

oh well, I'll refresh metadata on the whole library entry and rebuild all the images...

except...

2020-07-21 21:49:57.758 Info MediaProbeManager: ProcessRun 'ffprobe' Process exited with code 0
2020-07-21 21:49:57.827 Error BaseItem: Error refreshing item
*** Error Report ***
Version: 4.4.3.0
Command line: /Applications/EmbyServer.app/Contents/MacOS/EmbyServer.dll
Operating system: Unix 19.5.0.0
64-Bit OS: True
64-Bit Process: True
User Interactive: True
Runtime: file:///Applications/EmbyServer.app/Contents/MacOS/System.Private.CoreLib.dll
System.Environment.Version: 3.1.4
Processor count: 4
Program data path: /Users/antony/.config/emby-server
Application directory: /Applications/EmbyServer.app/Contents/MacOS
SQLitePCL.pretty.SQLiteException: Constraint: FOREIGN KEY constraint failed
SQLitePCL.pretty.SQLiteException: Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.
at SQLitePCL.pretty.SQLiteException.CheckOk(sqlite3 db, Int32 rc)
at SQLitePCL.pretty.StatementImpl.MoveNext()
at Emby.Server.Implementations.Data.SqliteItemRepository.InsertItemLinks(Int64 internalId, Int64 topParentId, List`1 values, IDatabaseConnection db)
at Emby.Server.Implementations.Data.SqliteItemRepository.UpdateItemLinks(Int64 internalId, Int64 topParentId, List`1 values, IDatabaseConnection db)
at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTranscation(IDatabaseConnection db, List`1 tuples)
at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(List`1 items, CancellationToken cancellationToken)
at Emby.Server.Implementations.Library.LibraryManager.UpdateItems(List`1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
at Emby.Server.Implementations.Library.LibraryManager.UpdateItem(BaseItem item, BaseItem parent, ItemUpdateType updateReason)
at MediaBrowser.Providers.Manager.MetadataService`2.SaveItem(MetadataResult`1 result, LibraryOptions libraryOptions, ItemUpdateType reason, CancellationToken cancellationToken)
at MediaBrowser.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.RefreshMetadataRecursive(BaseItem[] children, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, CancellationToken cancellationToken)
Source: SQLitePCL.pretty
TargetSite: Void CheckOk(SQLitePCL.sqlite3, Int32)

I get this for every single library item now, and I'm a bit lost as to what to do....

It seems I can no longer refresh metadata on anything (it happens when I attempt to refresh metadata on anything, single items or bulk....

Any help appreciated, maybe I can somehow clean the library database without removing everything and re-indexing my whole media library?

Thanks,

Antony

Edited by SirGanty
Link to comment
Share on other sites

SirGanty

I deleted my "movies" library, and re-created it and let it re-index, but it's till unable to refresh the metadata database (same FOREIGN KEY error for each item).

Starting to feel like I'm going to need to do something even more drastic, as I get the same error when trying to update any metadata in any of the libraries...

 😞

Edited by SirGanty
Link to comment
Share on other sites

SirGanty

I installed the latest update!

et voila!

all fixed! whatever process the app goes through to apply the update seems to have fixed my referential integrity issues in SQLite...

sorry for spamming 😇

Edited by SirGanty
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...