I have noticed in the last few days that users have been getting the message “There was an unexpected error loading this library” when accessing Movies or photos. No solutions yet and I ran into this same problem today after I rebuilt my music library. Now I can no longer access any movie database when I want to see “all movies” (the on deck, etc show up fine). This problem shows up on the embedded client (NUC running the latest libreelec nightly build), the mac client, the apple tv client and the web client. It does not affect the roku and iPhone clients (so far!). I can also fling a movie from my phone to the NUC embedded client and it works fine. Database optimization, reboot of the server and clients, logging out and back into the clients and server all do not work to solve the problem. My son and son-in-law run plex servers on linux and windows machines and those load the movies on my clients fine. We need help on this, as some users are likely not going to be able to access their movie databases except those movies that show up in the on deck, etc sections, or can fling them from a phone client.
- activate debug logging (not ‘verbose’!)
- quit Plex Server
- wait 1 minute
- start Plex Server
- wait 5 minutes
- fetch log files and attach them here
Or inspect them yourself. Take a look at the Plex Media Server.log file and seek for messages about database corrupt or malformed.
If you find these, you may have to repair your database.
https://support.plex.tv/hc/en-us/articles/201100678-Repair-a-Corrupt-Database
Hi Otto, thanks for the info, but the check said it was OK. I attached the server log per your instructions. There are errors, but I don’t know which ones are causing the problems and I don’t understand why it only affects some clients and not others.
@toxlab said:
Hi Otto, thanks for the info, but the check said it was OK.
Which check did you perform? There is a clear message in the log about the database being corrupt
Jun 01, 2018 14:03:02.014 [0x70000cf03000] ERROR - SQLITE3:0x70000d008590, 11, database corruption at line 72951 of [fc49f556e4]
Jun 01, 2018 14:03:02.014 [0x70000cf03000] ERROR - SQLITE3:0x70000d008590, 11, statement aborts at 7: [select distinct metadata_items.id from metadata_items left join media_items on media_items.metadata_item_id=metadata_items.id left join media_parts on media_parts.media_item_id=media_
This database needs to be repaired.
having same issue … bad plex release? unable to list my MOVIES - get same error: There was an unexpected error loading this library.
Hi Otto,
Thanks for all the help! It was my mistake on the sqlite by not escaping the blank spaces when using the terminal command to change directories (i am not used to these terminal commands and had to search how to do that). Once I did that (I also downloaded the sqlite for mac OS X and put it in the plugin directory) i ran the terminal commands to fix the database and all is good. Maccory, I suspect that this would fix your problems too.
Cheers,
Rod
here are my logfiles…ideas ? latest plex version (Version 1.13.2.5102) running on win10 os
Hi Maccrory,
I would go to https://support.plex.tv/hc/en-us/articles/201100678-Repair-a-Corrupt-Database and follow the instructions to repair your database on windows. If you have questions I can answer them, maybe (my server is an Mac), and save Otto’s time for other problems.
@maccrory said:
here are my logfiles…ideas ? latest plex version (Version 1.13.2.5102) running on win10 os
Indeed. The same issue.
Jun 02, 2018 08:59:36.832 [0916] ERROR - SQLITE3:0xf1f4eeba, 11, database corruption at line 72951 of [fc49f556e4]
Jun 02, 2018 08:59:36.832 [0916] ERROR - SQLITE3:0xf1f4eeba, 11, statement aborts at 7: [select distinct metadata_items.id from metadata_items left join media_items on media_items.metadata_item_id=metadata_items.id left join media_parts on media_parts.media_item_id=media_
Jun 02, 2018 08:59:36.833 [0916] ERROR - Soci Exception handled: sqlite3_statement_backend::loadRS: database disk image is malformed
By the way: go to Settings - Server - ‘Show Advanced’ - General
and remove the checkbox from ‘Allow Plex Media Server tokens in logs’
You should never enable this option. Never, unless instructed to do so by an employee of Plex, Inc.
@toxlab said:
Hi Maccrory,
I would go to https://support.plex.tv/hc/en-us/articles/201100678-Repair-a-Corrupt-Database and follow the instructions to repair your database on windows. If you have questions I can answer them, maybe (my server is an Mac), and save Otto’s time for other problems.
This rebuilding process does NOT look easy - how did the plex db become so delicate ? . Expecting users to d/l sql tools and enter commands at a prompt is not really a good solution.
And deleting the db and rebuilding it is NOT an legit answer when you have 5k movies and just as many series. This same issue happened to me once before when my db was much smaller and its a major PITA to recreate.
Also seems strange to me that a new release comes out and multiple ppl have the same issue ?
I’m a HUGE Plex supporter but this is the sort of thing that can put a black eye on the product. This db needs to be BATTLED HARDENED so this type of thing can’t happen - ever!. Thoughts ?
@maccrory said:
This rebuilding process does NOT look easy -
It is not that hard, once you get the hang of it.
You can copy & paste all of the commands.
(btw. the right download for Windows would currently be this one http://www.sqlite.org/2018/sqlite-tools-win32-x86-3230100.zip )
Also seems strange to me that a new release comes out and multiple ppl have the same issue ?
The corruption might have been silently growing for quite some time. The new plex version does a more complicated query, which takes more time.
If the DB is not perfectly healthy, this query might take too long - triggering thie error message you have been getting.
Tips for a healthy database:
- Never move your Plex data folder onto a network share
- personally, I’d also advise against moving it onto an external hard drive
- if you use anti virus software on your plex server machine, tell it to not interfere in the Plex data folder
- don’t perform library updates too often (every 30 minutes is madness, if your library has reached a certain size)
- keep your server switched on during the maintenance hours, so the Butler has a chance to do the housecleaning
- do not forcefully shut down your server computer while plex server is doing something
If you’re on Windows, I can walk you through the repair procedure.
Don’t hesitate to ask!
I meet all of the healthy db items listed above.
if there was a corruption in my db - why isnt there some way to alert me about the problem rather than waiting for what you stated above (The corruption might have been silently growing for quite some time. ). That seems like a LOGIC flaw to me that plex is unaware of an existing problem in the db?
I went to the link above (http://www.sqlite.org/download.html) to install the sql tools. I dont see any .exe files - only code that needs to be compiled? under windows binary’s there is 1 file that has a .dll which is not an EXE which is stated in the https://support.plex.tv/articles/201100678-repair-a-corrupt-database/ procedure. So I’m not sure which download would contain and exe and i certainly can’t compile source code ?
Right now I’m stuck because of the above . I would say my tech level is slightly above average but to expect a user who has little to no tech savvy to fix a problem like this is very unreasonable. And telling users to just DELETE the db is def not a reasonable request. Honestly, it would be much better if you (Plex) created a repair tool for db errors that users could download and repair the problem.
Again, that’s my opinion as a novice user.
I have edited my above post and inserted a link to the correct file.
No need to compile anything.
This rebuilding process does NOT look easy -
It is not that hard, once you get the hang of it.
You can copy & paste all of the commands.
(btw. the right download for Windows would currently be this one http://www.sqlite.org/2018/sqlite-tools-win32-x86-3230100.zip )
sorry i missed this in the above…thanks for pointing out the dl…i’ll give it a try
ran the steps listed for windows rebuild. last step/command i got this error
C:\Users\macserver\AppData\Local\Plex Media Server\Plug-in Support\Databases>sqlite3 com.plexapp.plugins.library.db < dump.sql
Error: near line 787881: no such collation sequence: naturalsort
So I take it the fix didn’t work? Any ideas ?
…
thats the same error i got when i listed the errors in the first step/ command:
C:\Users\macserver\AppData\Local\Plex Media Server\Plug-in Support\Databases>sqlite3 com.plexapp.plugins.library.db “PRAGMA integrity_check”
Error: no such collation sequence: naturalsort
here is a summary of the command prompts i executed per the instructions:
C:\Users\macserver\AppData\Local\Plex Media Server\Plug-in Support\Databases>sqlite3 com.plexapp.plugins.library.db “PRAGMA integrity_check”
Error: no such collation sequence: naturalsort
C:\Users\macserver\AppData\Local\Plex Media Server\Plug-in Support\Databases>sqlite3 com.plexapp.plugins.library.db .dump > dump.sql
C:\Users\macserver\AppData\Local\Plex Media Server\Plug-in Support\Databases>rename com.plexapp.plugins.library.db com.plexapp.plugins.library.db.original
C:\Users\macserver\AppData\Local\Plex Media Server\Plug-in Support\Databases>sqlite3 com.plexapp.plugins.library.db < dump.sql
Error: near line 787881: no such collation sequence: naturalsort
C:\Users\macserver\AppData\Local\Plex Media Server\Plug-in Support\Databases>
Oh dear.
Let’s try first something else.
make sure Plex server is still shut down
make a backup copy of the whole folder where those databases are stored
delete the files:
com.plexapp.plugins.library.db
com.plexapp.plugins.library.db-shm
com.plexapp.plugins.library.db-wal
now rename the most recent of the DB backup files, which are named like
e.g. com.plexapp.plugins.library.db-2018-05-01
to plain com.plexapp.plugins.library.db
start Plex server, wait a few minutes
then fetch log files again and search for the terms corrupt or malform in the Plex Media Server.log
So i did that - restored from 5/19. . No matches for corrupt or malform and now everything is working ok ? is it fixed or will it corrupt again ?
attached log file
@maccrory said:
is it fixed
It is.
In case it happens again, I have a new set of instructions for repairing. (2 more lines to copy)
But before I make them public, they need to get tested thoroughly.
If you have further troubles, feel free to send me your db file per PM. I will then try to repair it.
or will it corrupt again ?
Let’s hope not.
ok - thank you for all of your help !