Jump to content

Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.


Recommended Posts

Posted

When scanning the library getting a fail error with the below.  i've tried restarting both the machine and Emby?

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.SaveItem(IDatabaseConnection db, BaseItem item, Int64 topParentId, Int64 userDataKeyId, IStatement insertItemStatement, IStatement updateItemStatement)
at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTranscation(IDatabaseConnection db, List`1 tuples)
at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(List`1 items, Action`1 afterSave, CancellationToken cancellationToken)
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, Boolean setDateLastSaved, Boolean saveMetadata, CancellationToken cancellationToken)
at Emby.Server.Implementations.Library.LibraryManager.UpdateItem(BaseItem item, BaseItem parent, ItemUpdateType updateReason)
at MediaBrowser.Controller.Entities.BaseItem.UpdateToRepository(ItemUpdateType updateReason)
at MediaBrowser.Providers.Manager.MetadataService`2.SaveItem(MetadataResult`1 result, Boolean isFirstRefresh, LibraryOptions libraryOptions, ItemUpdateType reason, IDirectoryService directoryService, CancellationToken cancellationToken)
at MediaBrowser.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, LibraryOptions libraryOptions, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, LibraryOptions libraryOptions, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.TV.Series.RefreshAllMetadata(MetadataRefreshOptions refreshOptions, LibraryOptions libraryOptions, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.RefreshAllMetadataForContainer(IMetadataContainer container, MetadataRefreshOptions refreshOptions, LibraryOptions libraryOptions, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.RefreshMetadataRecursive(BaseItem[] children, MetadataRefreshOptions refreshOptions, LibraryOptions libraryOptions, Boolean recursive, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.RefreshMetadataRecursive(BaseItem[] children, MetadataRefreshOptions refreshOptions, LibraryOptions libraryOptions, Boolean recursive, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal(IProgress`1 progress, CancellationToken cancellationToken, Boolean recursive, Boolean refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
at Emby.Server.Implementations.Library.LibraryManager.PerformLibraryValidation(IProgress`1 progress, CancellationToken cancellationToken)
at Emby.Server.Implementations.Library.LibraryManager.ValidateMediaLibraryInternal(IProgress`1 progress, CancellationToken cancellationToken)
at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)

 

Happy2Play
Posted

@charleskPlease post the server log to show the exact error.

Happy2Play
Posted
3 minutes ago, charlesk said:

Sorry, here you go!embyserver.txt

Sorry you have a corrupt datadata.

SQLitePCL.pretty.SQLiteException: Corrupt: database disk image is malformed

Unfortunately, you will have to reset your database.

 

  • 2 years later...
Posted

Currently I am logged out or kicked out by Emby and when I try to log in I get the above mentioned error. Is there any other way to try the mentioned solution(s) ?

GrimReaper
Posted
8 minutes ago, Davey's said:

Currently I am logged out or kicked out by Emby and when I try to log in I get the above mentioned error. Is there any other way to try the mentioned solution(s) ?

Sorry, not following, any other way to try what? Steps to troubleshoot corrupted database? Integrity check/database recovery? For that your server needs to be shut down, so I'm unclear how's not being able to log in preventing you? 

But before any action taken, I'd suggest posting server log. 

Posted

@GrimReaperthanks. Well, sometimes it just takes some time, it seems, because I can now 'normally' log in again. -And view content. This afternoon I gave Emby some commands to update Metedata and images

Posted

Were you able to resolve it?

Posted

actually it solved itself :)

  • Thanks 1
  • 1 month later...
Posted

fwiw i saw similar behavior when I kicked off a very long-running transaction (deleting a library with 22 folders and more tv shows than i'd care to admit in it).  Server would throw these exceptions for pretty much any request while the database was churning away, but after enough patience the embyServer process completed (I had done an exit) and after that was able to restart with everything checking out as ok.  

  • Thanks 1
  • 4 months later...
Posted (edited)

I interrupted a library scan earlier today because Emby was scanning the wrong folders and now I am unable to remove that library. I keep getting the above error message each time I try to remove the library. Here are my most recent server logs and keep mind that I tried to follow the steps outlined in that link you posted but something seems to be amiss in the following directions:

Remove Database Locks

  1. Shutdown Emby

  2. Navigate to the folder containing your database file

  3. Delete library.db-shm & library.db-wal

  4. Restart Emby

 

librry.db-shm & library.db-wal are not visible in the folder while the Emby server is shutdown. Clearly there is some mishap in the order of directions here.

embyserver.txt

Edited by TVTech
Posted
15 hours ago, TVTech said:

I interrupted a library scan earlier today because Emby was scanning the wrong folders and now I am unable to remove that library. I keep getting the above error message each time I try to remove the library. Here are my most recent server logs and keep mind that I tried to follow the steps outlined in that link you posted but something seems to be amiss in the following directions:

Remove Database Locks

  1. Shutdown Emby

  2. Navigate to the folder containing your database file

  3. Delete library.db-shm & library.db-wal

  4. Restart Emby

 

librry.db-shm & library.db-wal are not visible in the folder while the Emby server is shutdown. Clearly there is some mishap in the order of directions here.

embyserver.txt 40.27 kB · 0 downloads

I anyone available to help me fix this problem? 

 

GrimReaper
Posted (edited)
9 minutes ago, TVTech said:

I anyone available to help me fix this problem? 

Unfortunately, it appears you'll have to rebuild your database (hopefully you have full backup) as you've added overlapping/nested folder paths to your libraries, with one of them having parent (X:\) folder/drive which you are trying to delete and you broke your db in the process. 

Quote
2025-01-11 16:50:15.362 Info LibraryMonitor: Watching directory with new FileSystemWatcher for X:\MOVIES\Musical for item 84206
2025-01-11 16:58:15.052 Info App: Removing item from database, Type: Folder, Name: X:\, Path: X:\, Id: 85807
2025-01-11 16:58:58.217 Error App: Error removing library
SQLitePCL.pretty.SQLiteException: Constraint: FOREIGN KEY constraint failed
	SQLitePCL.pretty.SQLiteException: Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.

Related thread:

 

Edited by GrimReaper
Posted (edited)
17 minutes ago, GrimReaper said:

Unfortunately, it appears you'll have to rebuild your database (hopefully you have full backup) as you've added overlapping/nested folder paths to your libraries, with one of them having parent (X:\) folder/drive which you are trying to delete and you broke your db in the process. 

Related thread:

 

I don't have a backup of my library database and I wouldn't even know how to begin rebuilding my database. What are my other options here? Surely there must be something else besides a complex process which I am not familiar with. At least tell me the exact steps that I need to do to fix this instead of just dropping this massively bad news on me without any other feedback.

 

 

Edited by TVTech
Happy2Play
Posted
3 hours ago, TVTech said:

I don't have a backup of my library database and I wouldn't even know how to begin rebuilding my database. What are my other options here? Surely there must be something else besides a complex process which I am not familiar with. At least tell me the exact steps that I need to do to fix this instead of just dropping this massively bad news on me without any other feedback.

 

 

It will be difficult to say unless one of the database gurus has some advice as your parent and child folder paths sort of breaks the database.  @sa2000

Have you tried removing folder paths of the child libraries working back to ie parent path X:\?

Otherwise you will potentially have to start a new database unless someone provides the manual commands to attempt to correct the db issue.

As there really needs to be more features in-place to prevent parent and child paths from being added at all.  But think thinks have been put in-place for future versions but not current versions.

Posted
1 hour ago, Happy2Play said:

It will be difficult to say unless one of the database gurus has some advice as your parent and child folder paths sort of breaks the database

5 hours ago, TVTech said:

I don't have a backup of my library database and I wouldn't even know how to begin rebuilding my database. What are my other options here? Surely there must be something else besides a complex process which I am not familiar with. At least tell me the exact steps that I need to do to fix this instead of just dropping this massively bad news on me without any other feedback.

 

If you had "X:\" as a path as well as lower levels eg "X:\Movies" as a path as well, then I think you will need to delete all the libraries that had any path starting with "X:" and recreate them - start by deleting those libraries and then after all are deleted, then recreate them ensuring no overlapping paths. Also it is not recommended to have a path with just a drive letter - ensure you have folders eg "X:\Movies" and "X:\TV" etc. And do them serially - create one, wait for it to be created and the scan completed and then create the next

  • 2 weeks later...
LyraTheLycan
Posted

I seem to have triggered this database error while attempting to use certain built-in subtitles from a video file. Perhaps an FFMPEG write error? It destroyed all connections to Emby while the video was playing, throwing that error on login attempts. It resolved itself - shutting down Emby automatically removed the library.library.db-shm & library.db-wal files, and everything runs perfectly with a separately downloaded subs file.

Posted
22 minutes ago, LyraTheLycan said:

I seem to have triggered this database error while attempting to use certain built-in subtitles from a video file. Perhaps an FFMPEG write error? It destroyed all connections to Emby while the video was playing, throwing that error on login attempts. It resolved itself - shutting down Emby automatically removed the library.library.db-shm & library.db-wal files, and everything runs perfectly with a separately downloaded subs file.

Hi, please attach the Emby server log:

Thanks.

LyraTheLycan
Posted
18 minutes ago, LyraTheLycan said:

This was when I restarted, and tried using the subtitles... I believe I see the issue. Testing now.

embyserver-63873516907.txt 81.92 kB · 1 download

My disk was full. Looking at a 9GB metadata folder now, either way it turns out my issue wasn't related to this thread, sorry.

  • Thanks 1
Posted

Thanks for following up.

  • 4 months later...
IAmHugh
Posted

I have the Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown error trying to sign into Emby. I installed the beta by mistake and I would leave it but for some reason the FireTV apps will not pick it up. I uninstalled it and installed the official Emby-server and now get that message. I stooped the Emby service, uninstalled Emby, removed the Emby items in /var/lib/, reinstalled Emby and am still getting that error. I would just as soon remove EVERYTHING and start from scratch.

Posted
4 minutes ago, CummingCowGirl said:

I have the Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown error trying to sign into Emby. I installed the beta by mistake and I would leave it but for some reason the FireTV apps will not pick it up. I uninstalled it and installed the official Emby-server and now get that message. I stooped the Emby service, uninstalled Emby, removed the Emby items in /var/lib/, reinstalled Emby and am still getting that error. I would just as soon remove EVERYTHING and start from scratch.

Hi, you can't go back and forth between the two. What emby items did you remove?

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...