Issue with modifying collections for 1 library

Server Version#:4.110.1
Player Version#:114.0

Hi. I have been using collections for a while now and have never come across this issue before. When I try to modify the collections or create a new collection within only my TV Shows library I get the error "Your changes could not be saved. " I have tried optimizing my database, and repairing my database as shown in this link: https://support.plex.tv/articles/repair-a-corrupted-database/, and when I did that, there was no corruption found as far as I am aware. I am able to modify every other part of the shows in this library such as the title, date etc
 but the collections part throws this error every time. I also have tried making and modifying collections on my movies library, and everything happens with no errors.

Attached is my server logs in case that helps, and these are the only logs I see when trying to modify collections inside of the TV library:

Jul 05, 2023 00:47:14.989 [20844] Warning — [Req#6e88bf] QueryParser: Invalid field ‘contentDirectoryID’ found, ignoring.
Jul 05, 2023 00:47:14.989 [20844] Warning — [Req#6e88bf] QueryParser: Invalid field ‘pinnedContentDirectoryID’ found, ignoring.
Jul 05, 2023 00:47:19.528 [2460] Info — Request: [192.168.1.150:57210 (Allowed Network (Subnet))] PUT /library/sections/2/all?type=2&id=126065&includeExternalMedia=1&collection.locked=1&collection%5B0%5D.tag.tag=fgf (17 live) #6ed8bf TLS GZIP Signed-in Token (NintendoFanBoyFTW) (Chrome)
Jul 05, 2023 00:47:19.872 [2460] Warning — [Req#6ed8bf] Held transaction for too long (E:\jenkins\server\3578728709\Library\MetadataCollection.cpp:523): 0.390625 seconds
Jul 05, 2023 00:47:20.924 [2460] Error — [Req#6ed8bf] Exception inside transaction (inside=1) (E:\jenkins\server\3578728709\Library\LibrarySectionPutAll.cpp:845): bad lexical cast: source type value could not be interpreted as target

Jul 05, 2023 00:47:20.924 [2460] Error — Got exception from request handler: bad lexical cast: source type value could not be interpreted as target
Jul 05, 2023 00:47:20.924 [15564] Info — Completed: [192.168.1.150:57210] 500 PUT /library/sections/2/all?type=2&id=126065&includeExternalMedia=1&collection.locked=1&collection%5B0%5D.tag.tag=fgf (17 live) #6ed8bf TLS GZIP 1396ms 530 bytes (pipelined: 17)

EDIT: I forgot to note that I have tried restarting the server, and this happens across several devices I have tried so it is not isolated to a particular browser.

Plex Media Server Logs_2023-07-05_00-42-55.zip (968.7 KB)

I also just did a test with restoring an order backup from a couple of weeks ago that I have of my database and blobs file, and the issue persists even though those backups were from a time where I did not have this issue

After doing a lot of testing I determined that it was not the database at all causing the problems. The problem was with the latest beta version of Plex

1.32.5.7210-77f7f99fa

which for some reason causes my TV library to stop working with collection creation. This only seems to affect manual collections and not smart collections

My system just updated to the latest non beta build and this issue is back. Can someone please help me figure out what is wrong with the latest Plex beta build and adding items to my collections in TV

I have narrowed down the update that makes this all occur.

When running PlexMediaServer-1.32.4.7195-7c8f9d3b6-x86_64 everything works fine. I can create and modify collections (It is a bit slow to save the changes then I remember in the past)

When updating to the next version PlexMediaServer-1.32.5.7328-2632c9d3a-x86_64 everything does not work. I can update the movie library collections fine but TV Shows does not work

Is anyone able to at least direct me to someone from Plex that could possibly look into this issue. I have done all of the DB repair steps and none of them fix this issue on the latest version of Plex.

Just to reiterate the issue:

On the latest version of Plex, when trying to add or modify collections only on my TV Show library I get the error “your changes could not be saved” and the log error of “Got exception from request handler: bad lexical cast: source type value could not be interpreted as target”

Reverting to Plex version 1.32.4.7195 or below works just fine no issues and nothing in the logs.

I don’t know if anyone else has been able to recreate this issue because I do have a lot of collections and not sure if it is a scale issue, but this is not good and the fact that it works fine on a lower version would indicate to me that a change in Plex Server caused the issue not my DB

@NintendoFanBoyFTW

Thank you for the link in the other thread.

Windows is not my forte (I don’t have a Windows VM)

From the excerpt you posted above, there isn’t enough detail to see what’s failing.
“Bad lexical cast” itself is meaningless but does point to some other problem.

Please enable DEBUG logging and recreate then download & attach the ZIP logs.
DEBUG logging will let me see what it doesn’t like.

Ok here is a fresh log I just got with Debug turned on. latest version of Plex just installed now. adding movies to collections work fine. adding or modifying anything with collections on TV shows does not work as shown above

Plex Media Server Logs_2023-08-05_19-03-53.zip (2.0 MB)

Thanks
 Give me a few minutes please to go through it :crossed_fingers:

Thank you.

Got it.

I see what it was trying to do leading up to the failed DB transaction which is what I needed to see.

So I write this correctly, can you give me a description of what you were trying to do when the error occurred ? Is it as simple as clicking on a few TV Series and creating a collection?

Aug 05, 2023 19:03:24.172 [29648] DEBUG - Request: [192.168.2.7:44480 (WAN)] GET /media/providers?includePreferences=1 (9 live) #41f GZIP Signed-in Token (NintendoFanBoyFTW) (i3-NUC)
Aug 05, 2023 19:03:24.191 [6512] DEBUG - Completed: [192.168.2.7:44480] 200 GET /media/providers?includePreferences=1 (9 live) #41f GZIP 18ms 10542 bytes
Aug 05, 2023 19:03:24.302 [22172] DEBUG - [Req#3f5] PlayQueue: Converted 'server://e0b7031658a8d267f28b972f69082377ef065963/com.plexapp.plugins.library/library/sections/2/all?type=2&sort=originallyAvailableAt&episode.originallyAvailableAt%3C%3C=1970-01-01&and=1&episode.originallyAvailableAt%3E%3E=1959-12-31' to 'library://x/directory/%2Flibrary%2Fsections%2F2%2Fall%3Ftype%3D2%26sort%3DoriginallyAvailableAt%26episode%2EoriginallyAvailableAt%253C%253C%3D1970-01-01%26and%3D1%26episode%2EoriginallyAvailableAt%253E%253E%3D1959-12-31'
Aug 05, 2023 19:03:24.302 [22172] ERROR - [Req#3f5] Exception inside transaction (inside=1) (E:\jenkins\server\4164030896\Library\LibrarySectionPutAll.cpp:845): bad lexical cast: source type value could not be interpreted as target
Aug 05, 2023 19:03:24.303 [22172] ERROR - Got exception from request handler: bad lexical cast: source type value could not be interpreted as target
Aug 05, 2023 19:03:24.303 [6512] INFO - Completed: [192.168.1.151:49470] 500 PUT /library/sections/2/all?type=2&id=126512&includeExternalMedia=1&collection%5B0%5D.tag.tag=HBO&collection%5B%5D.tag.tag-=ZZZForceVisable (8 live) #3f5 TLS GZIP 1076ms 530 bytes (pipelined: 11)
Aug 05, 2023 19:03:25.342 [22172] INFO - Request: [192.168.1.151:49470 (Allowed Network (Subnet))] PUT /library/sections/2/all?type=2&id=126512&includeExternalMedia=1&collection%5B0%5D.tag.tag=HBO&collection%5B%5D.tag.tag-=ZZZForceVisable (7 live) #426 TLS GZIP Signed-in Token (NintendoFanBoyFTW) (Chrome)
Aug 05, 2023 19:03:25.383 [22172] DEBUG - [Req#426] Collections: Found 2 collections tags in section 2.
Aug 05, 2023 19:03:25.384 [22172] DEBUG - [Req#426] Collections: We had 3 collections in the library already.
Aug 05, 2023 19:03:25.384 [22172] DEBUG - [Req#426] Collections: Synced tags in section 2 in 38ms.
Aug 05, 2023 19:03:25.423 [22172] DEBUG - [Req#426] Collections: Found 0 collections tags in section 2.

It looks like the Epoch/bad date got in there where not expected so it defaulted to Epoch. (bad lexical cast)

1970-01-01

I tried to remove a collection from a TV show and then tried to click save changes. I then clicked save changes a couple more times or tried doing another show just so you could see the same issue show up several times in the logs

Please forgive me being pedantic (I’m old and forgetful :stuck_out_tongue: lol)
but it helps so I can write it up and be able to answer engineering’s questions.

  1. You had an existing tv show collection
  2. You then wanted to delete (remove) the collection (break the association)
  3. It would not allow you to save the changes.

Repeating this process on other tv shows resulted in the same error

:thinking:
looks in dictionary for repeating the same actions over and over but expecting a different result :rofl:

(sorry. looooong week here)

Do I understand now?

Lol, yes I was trying multiple times just so you could see the issue occuring multiple times in the log in case it showed more info.

Basically in addition to what you outlined, I cannot create a new TV collection, I cannot add a TV show to an existing collection, and like you said, I cannot remove a TV show from a collection it already is in.

As far as I am aware, this is not happening with my movie Library, but it could be something to look into for that as well.

Also, I am willing to show anyone the issue more in depth if needed and obviously if you guys need any more logs of something specific, whatever you guys need to fix this issue haha

I’ll do the first recreation if I can.
If not, and if they can’t, someone will reach out to you. Thanks.

For laughs , but also a hunch,
I wonder if one of the Index tables in your DB didn’t update correctly.
(I saw errors in “DBFixUps” processing after the schema changes).

Would you be willing to give this a quick run? (the .BAT version for you. the .sh for Linux/Synology users)

In addition to sorting and cleaning the DB, it also rebuilds all the index tables (which are important to PMS and collections)

Yepp way ahead of you, I had tried that repair last week and it did not fix the issue unfortunately.

It was worth a shot.

Finishing my writeup now

Bug report (issue) # 14484 now completed.

When resolved, it’ll be so posted in the Release Announcments under FIXES:

1 Like

If it’s helpful, I just noticed that Plex does not automatically create collections for sets of movies when in this state either. I had the opposite problem from @NintendoFanBoyFTW because my TV shows work fine, but movies don’t; maybe a 50/50 which library(ies) break after update.

We tried to recreate this and couldn’t.

Might you be able to help us with a procedure that does (reasonably) reliably cause it to fail?