PMS UPDATE - Yet Again

Thanks for the log files.

There are still some database problems.

From Plex Media Server.2.log (attempted update to 1.40.5):

Sep 12, 2024 15:41:29.932 [63360] ERROR - Exception inside transaction (inside=1) (D:\gha\plex-media-server\plex-media-server\Library\DatabaseMigrations.cpp:342): Null value not allowed for this type
Sep 12, 2024 15:41:29.933 [63360] ERROR - Exception thrown during migrations, aborting: Null value not allowed for this type
Sep 12, 2024 15:41:29.933 [63360] ERROR - Database corruption: Null value not allowed for this type

DBRepair looks at the structure, but not the content, of the database. The log file errors indicate a problem with the content.

So … more work using the Windows command line. This time deleting unnecessary data in the Plex database.

As a reference, see this post: Upgrade to 1.40.0.7998 causes error - #38 by FordGuy61.

Need to do the same thing on your server, but adjust slightly since your database is in a different location.

  1. Stop Plex Media Server.

  2. Make a backup copy of the Plex database files com.plexapp.plugins.library.db and com.plexapp.plugins.library.blobs.db (just being safe :slight_smile: ).

  3. Open a CMD window (C:\ prompt, like when you ran DBRepair).

  4. At the C:> prompt, enter: "C:\Program Files\Plex\Plex Media Server\Plex SQLite.exe" "N:\Plex-Back-up\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db"

  5. That should open the database in SQLite and give you a sqlite> prompt.

  6. Enter the following two commands:
    sqlite> DELETE from external_metadata_items; ← the semi-colon is important
    sqlite> .quit ← notice the leading period.

  7. You should be back at the C:\ prompt. You can close the CMD window.

  8. Start Plex Media Server. Make sure it starts OK.

  9. Now, stop Plex Media Server and try to update. Suggest you update to the current public version, 1.41.0.8992 instead of 1.40.5. You’ll get the latest updates. The major database changes started with 1.40.0, so updating to 1.41.0.x vs 1.40.5.x is not much of a difference from a db point of view.

Hopefully all goes well. :pray:

I’ll give it a shot, Much appreciated … :facepunch:

Parse error: near ““N:\Plex-Back-up\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db””: syntax error
"N:\Plex-Back-up\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugi
^— error here

I just typed it in, instead of CnP and it worked, LOL
Now for the Big test! :pray: :pray: :pray:

ugh
O’well It was a good try
going down the line of my Dl’s and looks like it stopped on PlexMediaServer-1.40.2.8395
and the Database is loading (Hopefully) it’s an upgrade! Version as well too! from PlexMediaServer-1.32.7.7571 So if it does complete, It’s a Win Win.

Update… 1.40.2.8395 Wont stay connected… Fail…

You know I’ve already came to the conclusion that I probably could of just did a fresh install and did the epic 5 day wait on the Library DL by now But it’s more than a why is it doing this now kinda thing? I did just realize its just a version skip, from 1.3s to 1.4, that is doing it, so it’s not allowing the Library to come out to play from ver. 1.4 build 8392 thru 8555 wont work at all, they get the Corrupt Database and Ver. 1.4 Bld 7998 thru 8395 they get they empty database, (“Something went wrong”) in every folder or location. But any Version that’s 1.32 works perfectly Fine, which I have to switch back to 1.32 Build 7571 and all is right with the world! except for the ridiculous lag and I’m sure the many upgrades I’m losing out on! so any Ideas from the crowd? @FordGuy61 has been the Ninja thus far, I’m sure his head is about to splode! I can’t thank him enough already! If it helps I drive a 2000 Lifted Expedition (Triton) :metal:

It looks like it was working.

You started PMS v1.40.2.8395 at 02:35:10. It ran for 13 minutes, performing database migrations, then stopped at 02:48:32 (Plex Media Server.5.log).

I cannot tell if Plex crashed or you killed it. The log gives no indication.

The subsequent restarts (.1 to .4) all end in Error: Unable to set up server: bad cast. I do not know of any way to recover from that error.

When you loaded 1.40.1.8227, it runs, but has many SQLITE database errors. The errors are related to content, not structure, so DBRepair will not fix them.

Best I can tell, the current database files may be too damaged to repair.

Did you make a backup of the database files before editing them in Plex SQLite (step 2 in my earlier post)?

Suggestions / Options:

First, install either 1.40.2 or the current release, 1.41.0.8892.

Option 1: If you made a backup, then stop PMS, restore the backup version, and repeat the steps above where you issued the “DELETE from external…” command. Then start Plex Media Server and wait, definitely longer than 13 minutes. You can monitor activity in Plex Media Server.log using the PowerShell command mentioned earlier in the thread.

Option 2: Use a backup copy of the database. Stop Plex, move the two current database files out of the Plex folder (off the N: drive), then pick one of the backups and remove the appended date so they ends in .db. Then go through the “DELETE from external…” process, and then start PMS and see what happens.

Option 3: Hate to say it, but it might be time to toss the db and start over. I know it will take days to recreate things, but I’ve no other ideas.

I’m out of pocket the rest of the weekend. I’ll check in either late Sunday or some time Monday (US Central time).

There was probably a point in time when he restored from backup and didn’t remove the existing -wal files. So now his database is corrupted. That’s one reason that would explain the bad cast error.

Yes I did do the back-up, and I’m at that point of doing it, I’m thinking it might be to corrupt to fix because it has other small issues other than the obvious, I’ll try your suggestions first then if it doesn’t work I’ll just bite the bullet and Suffer the dreaded Library load of hell on A Fresh install.

You mean you restored from backup or you created a backup?

Read up on how to restore correctly; there’s some files that are not supposed to be there when you add the old backup database.

I did a Backup before I did the DELETE yes, And I’ll read on what I should do on the .db restore before I redo the restore. But Like Ford said I might have stopped it to soon not knowing that it was still building even though the library upload bar went away, I’m going to try it again one more time and this time I’m just going to walk away.

After a lot of back and forth @FordGuy61 got it back to a working Plex server, I can’t thank him enough. Long Process but it worked out in the end, we did figure out what is corrupting my data files, My Data files are stored in a USB drive which I’m completely maxed out (USB Ports) and unfortunately they disconnect from time to time so you know what that means, if plex is writing while it DC’s, the data corrupting will continue if I don’t fix the issue. So next issue to fix… thanks to everyone for the assist. Especially Ford.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.