Yet another example of why the modern Plex Metadata Agents are not fit for purpose

Up until last week the show Spartacus and its special season Gods of the Arena was picked up correctly by plex using tmdb episode ordering matching all metadata, titles, summaries, rating, cast etc… as per tmdb.

However, this week after a metadata refresh all the episodes for this season are now unmatched by plex with all the data removed . Unmatching also changes the guid to a local id which also now means any watch history or view state for the episode is also gone! Grrrr…


The cause of this is some ill advised person over at tmdb created this entry Spartacus: Gods of the Arena (TV Series) — The Movie Database (TMDB) which now has been matched by the plex back-end (even without any tmdb internal linkage) resulting in dup ids for the show …

Spartacus (2010)
  plex://show/5d9c0833ba2e21001f18ea2b
  imdb://tt1442449
  tmdb://303022
  tmdb://46296
  tvdb://129261

While that is the reason (and I’ve ask for the show to be removed Reported Problem for Spartacus: Gods of the Arena - Discuss Spartacus: Gods of the Arena — The Movie Database (TMDB)) the bigger problem is the poorly designed code at plex not having any safeguards or validation to understand this is bad, so it just nukes it. The existing good data is replaced it with empty, no data!

$hit happens, folks create bad entries all the time but the plex code needs to be smarter …

2 Likes

Took a gamble knowing I might mess up the matching after your report, refreshed the metadata but mine is still the way it should be and matched fine:

I bet your using tvdb episode ordering and not tmdb.

After checking, I am indeed. Good reason to continue doing so too!

For anyone who cares, this show is now working again after my report was processed at tmdb.

Regardless, the overall issue renames, it should never have happened as the plex metadata code needs to be better.

After the issue was “fixed”, did you regain your watch history and view state?

Raising your issue now but wanted to confirm :backhand_index_pointing_up: also. Thanks for reporting.

It did not as the episode guid have changed so plex kinda sees them as a new episode. I guess this happens because they became unmatched and plex assigned a local guid when it happened.

However, I was able to manually fix these up within the metadata_item_settings and metadata_item_views tables.

Unfortunately, this isn’t the first time this has happened so I know how to deal with it. I reported the problem way back in 2022 Plex Episodes changing from played to unplayed due to online metadata source change.

My understanding on this (I’m asking around for clarity) is that your local history and states are stored by the ratingKey and Plex GUID. Anything synced to plex.tv would use the Plex GUID. The ratingKey should not be changed if simply unmatched. Unmatching a title then viewing the Watch History should result in the same data as when it was matched.

Since the the ratingKey shouldn’t change and the Plex GUID did not change, your watch history and states also should not have changed.

I assume that this Special was watched previously and the screenshot of the Special above is the proof that watch history/state was removed. Without another metadata source change it’ll be difficult to reproduce this. Regardless I’ve at least raised this with the server folks.

I did test around this as best as I could without a metadata source change. Let me know if you’ve got something else to try or I’ve missed something.

Setup:

Series with some episodes

  • 1 episode in-progress
  • 1 episode marked as watched
  • 1 episode actually watched

Test:

  • Unmatch, refresh metadata, Fix Match back to original series
    • original Plex GUID → blank GUID → original Plex GUID
  • Fix Match to another series, refresh metadata, Fix Match back to original series
    • original Plex GUID → new Plex GUID → original Plex GUID
  • Dance away series and readd series
    • new ratingKey

Result:

While viewing the Series detail page the states and watch history never changed between any of the tests and their steps. Again, in my understanding, this is expected and shows resilience to handling the problem of metadata source changes.

Thanks for investigating, appreciate it.

I’m away from my pc atm but do have some ideas to try and force this situation myself. I’ll update the thread when I do. Thanks again.

1 Like

Okay, so I’ve been able to force this change. Lets take this show Star Wars: Clone Wars (TV Series 2003-2005) — The Movie Database (TMDB) and I’ve named my files match tvdb (dvd) ordering, all episodes are watched and have played history …

Now, lets simulate a change by changing the episode ordering in plex to The Movie Database (Aired), which is a significantly different ordering than the DVD order. I have not renamed the files, only changed the order in plex. Force refresh the show at this point. The watch history etc… all remain. No problems so far however episodes 1x11 → 1x20 are unmatched.

Now, revert the change and set it back to TheTVDB (DVD). Force refresh again and boom, 5 episodes have switched from watched to unwatched.

These are episodes 1x11 - 1x16.

1 Like

Great show!! Thanks, taking a look now.

What the heck… why is it only these episodes. :thinking:

Also confirmed and easily reproducible. Adding this into the issue. Thanks again! :plexheart:

1 Like

Thanks, I feel less crazy now :slight_smile:

I’m not sure why these episodes and not others. It appears somewhat random to me but there has to be come code logic behind it. I’ve seen this happen in past for some shows and not others which have had radical episode ordering changes.

Anyhow, this is kinda a side issue (at least for me) as I know how to fix this when it happens. What is beyond frustrating is the back-end metadata scrapper continuing to match ids, duplicating them for shows and then deleting valid metadata content due to how its being scored. This just should not happen and I’ve no real control to fix it on my plex server.

If I hadn’t figured out what happened by looking at the dup ids for the show and have the bad entry deleted at tmdb then plex would still be broken for this show using tmdb episode ordering.

BTW… for giggles take a look at The Animatrix (2003) — The Movie Database (TMDB) and the xml on your plex back-end and you will see the following …

Every time I check for new dups this makes me laugh!

The removal of watch history/state seemed like the more important issue initially. So returning to the “root” of the issue in the OP, I’ll split this out into it’s own issue for guidance. Can I assume the “solution” would be to allow for locking a title down to no longer receive changes? Or was there something else you had in mind? Just trying to gauge expectations.

Man… what did they do to The Animatrix… So it’s a Show but also a Movie with 9 Movies in it… :see_no_evil_monkey:

Maybe. However I suspect at least in this case its a situation where the bad dup id was added to the top of the list for this show in plex. So, tmdb://303022 was the new bad id and it was placed above the good id tmdb://46296. With the bad id being first plex uses it and ignores the second existing one which had all the good data.

Spartacus (2010)
  plex://show/5d9c0833ba2e21001f18ea2b
  imdb://tt1442449
  tmdb://303022
  tmdb://46296
  tvdb://129261

I’d suggest, in situations where a second (or subsequent) ids are added they are incremented below any existing ids. This will mean at least any existing metadata would remain and wouldn’t be nuked by a duplicate ids being added. If cleanup is needed, it should happen organically by the community to remove the bad entry.

Plex seems to be defaulting to the newer one, which seems like a bad idea at least to me.

1 Like