TV Shows empty trash deletes newly added and all other episodes

I posted a question about this a couple of months ago but never got a response. When I add new episodes to any number of TV shows that are already in the Plex library, then empty the trash, all those episodes and the entire season are deleted. I have to re-scan the TV library to get them back, and they all appear to be newly added. I’m running the latest server preview release (1.6.1.3722) on Windows 10, but this has been happening on prior preview releases for quite some time. Anyone have any suggestions on what to do about this?

Thanks in advance for your help.

How do you go about adding new episodes?
Are you simply adding the new episode files or do you also modify folders?

Are you adhering to the Plex naming recommendations for tv shows?
These are crucial to follow.

Are your files in mp4/m4v format?

@OttoKerner – thanks for the quick response. Episodes are almost always mp4 files that do adhere to the Plex naming recommendation. For instance:

Fargo/
Season 1/
Fargo S01E01.mp4
Fargo S01E02.mp4
Season 2/
Fargo S02E01.mp4

Here is the scenario:

  • I add Fargo S02E02.mp4 to the proper folder above
  • I delete an episode from a different TV show, say Blue Bloods/Season 1/Blue Bloods S01E20.mp4 (but make no other file/folder changes)
  • Plex picks up the changes right away - i.e., Fargo S02E02 appears in the library, and Blue Bloods S01E20 is marked unavailable (with the trashcan icon)
  • I empty the trash in Plex
  • Plex deletes the Blue Bloods S02E02 episode that is no longer in its folder (as it should)
  • Plex also deletes the Fargo S02E02 episode that I just added, and the Fargo S02E01 episode that was added perhaps a week earlier, and all other Fargo S02 episodes
  • I’m typically adding new episodes to several TV shows at a time, and when I empty the trash Plex deletes all of these as well, and all other episodes from the latest season of those shows (I think the season still appears in the Plex library, but with no episodes in it)
  • Note that it doesn’t matter what TV show episode I delete; it could be from a show/season that I just added a new episode to, or it could be from a totally different show/season as in the above example
  • I have to re-scan the TV Show library to get all these episodes back

This is bizarre, to say the least.

@boblinthewild said:
Episodes are almost always mp4 files that do adhere to the Plex naming recommendation. For instance:
Fargo/
Season 1/
Fargo S01E01.mp4

Not completely.

Fargo/
    Season 01/
       Fargo - S01E01.mp4

Notice the 2-digit season number in the season folder
and the hyphen separating the show title from the season/episode code in the file name.

Also important: is your tv show library pointing to the fodler directly above of Fargo/?
It must not point higher in the hierarchy and you must also not add the Fargo/ folder directly to it.

Since your files are mostly mp4, embedded Title tags could influence things negatively.
Go to Settings - Server - Agents - Shows - TheTVDB
In there, grab the line ‘Local Media Assets’ with your mouse and drag it downwards, so it ends up being at the bottom of the stack of active agents.
Repeat the same under
Settings - Server - Agents - Shows - TheMovieDatabase
Do not disable the Local Media Assets agent completely, unless you never want to use extzernal subtitles or posters or theme music.

After doing this, perform the Plex Dance with the worstly affected show.
Do make a note which episodes are already ‘watched’, because the ‘Dance’ may erase this information under some special circumstances.

With that out of the way, here are some additional questions:
Are you downloading directly into your library folders? i.e. are there sometimes incomplete files in there? You must avoid this.

Is your media storage internal to your server or are you using external drives or a NAS?
If so, I strongly recommend to
a) Settings - Server - Library - ‘Update my library automatically’ DISABLE
b) Settings - Server - Library - ‘Empty trash automatically after every scan’ DISABLE

@OttoKerner – I thought I read somewhere that the leading zero in the season name and the dash in the episode name were not really important (note – until relatively recently - like sometime in the last 6 months or so - this has worked perfectly for me). Nevertheless, I will invest some time in updating my episode names (9,000+ of them!) to see if that helps. I should be able to test it with a few shows to find out.

My TV Show Plex library points to the following folder structure, which I believe matches what you advised (i.e., Plex is pointed to “TV Shows/”):

TV Shows/
Fargo/
Season 1/
Fargo S01E01.mp4
Fargo S01E02.mp4

etc.

I’m aware of the possible impact of mp4 tags and diligently remove them before copying the files to the folder Plex watches. The “Local Media Assets (TV)” agent is third in my agent list, below “The TVDB” and “The Movie Database.” Nevertheless, I will move it to the bottom of both lists to see if that helps.

I am using external USB drives for all my Plex-watched folders. I download files elsewhere and only copy completed files into these folders. [side note – I also have movie folders where I will add and occasionally delete files, and Plex handles these adds and deletes properly - i.e., it doesn’t delete anything I haven’t specifically deleted myself.]

“Empty trash automatically after every scan” is, and always has been, disabled.

I don’t understand how disabling “Update my library automatically” will help. Can you please elaborate?

Thanks again for your help with this.

@boblinthewild said:
I thought I read somewhere that the leading zero in the season name and the dash in the episode name were not really important

This became important under some circumstances within the last few months.
Since the ‘matching’ uses heuristic algorithms, it is not so easy to say whether it is important or not. Tests have shown, it can contribute to a successful matching.

My TV Show Plex library points to the following folder structure, which I believe matches what you advised (i.e., Plex is pointed to “TV Shows/”):

Perfect.

I’m aware of the possible impact of mp4 tags and diligently remove them before copying the files to the folder Plex watches. The “Local Media Assets (TV)” agent is third in my agent list, below “The TVDB” and “The Movie Database.”

It is fine there. No need to move it further downwards.

I am using external USB drives for all my Plex-watched folders. I download files elsewhere and only copy completed files into these folders.

:+1:

I don’t understand how disabling “Update my library automatically” will help. Can you please elaborate?

It is merely a hunch. For instance USB connections are not very reliable. They may have connection issues sometime, possibly in conjunction with drive or computer ‘power saving’ mechanisms.
It may just be, that library updates are triggered by power ‘brownouts’ or similar conditions, which then may lead to Plex thinking the files are not there anymore.

I’d enable debug logging on the server. Then immediately after such an occurence, grab the log files and post them here.

I don’t think the external drives are contributing to this, and I’d not sure the naming is, either. Plex does the matching of newly added episodes perfectly, and immediately upon adding them. The disks are spinning because I just copied a file there, and Plex is set to automatically update when it detects changes. The only problem is that episodes are then unnecessarily and inappropriately deleted when I empty the trash (which I do immediately after the library update finishes).

I’ll make the naming changes, do some testing and report the results with logs if the problem persists.

Thanks again.

@boblinthewild said:
The disks are spinning because I just copied a file there, and Plex is set to automatically update when it detects changes.

You are missing my point: Plex may think there was a change in the library when a drive goes down/unavailable/whatever. When it triggers a library update in this moment, that is when the issue may appear.

Still not working. Logs attached. Here’s what I did:

  1. Renamed “Designated Survivor” folders and files per your suggestion and performed Plex Dance. Folder structure looks like this:

    TV Shows/
    Designated Survivor/
    Season 01/
    Designated Survivor - S01E01 WEBRip.mp4
    .
    .
    Designated Survivor - S01E17 WEBRip.mp4
    Designated Survivor - S01E17 WEB-DL.mp4
    .
    .
    Designated Survivor - S01E20 WEBRip.mp4

  2. Deleted “Designated Survivor - S01E17 WEB-DL.mp4” from the folder

  3. Added new “Designated Survivor - S01E21 WEBRip.mp4” to the folder

  4. Plex marked the entire Season 01 for deletion (trashcan icon)

  5. Plex picked up the newly added episode 21

  6. Emptied the trash and all episodes were deleted (show disappeared from library)

  7. Re-scanned the TV show library and all episodes reappeared

Suggestions on what to try next?

Thanks.

Those names still aren’t correct.

Your name:
Designated Survivor - S01E.71 WEBRip.mp4

Better option:
Designated Survivor - S01E17 [WEBRip].mp4

In accordance with TVDB:
Designated Survivor - S01E17 - The Ninth Seat.mp4

Before I change all these file names to put brackets in, help me understand why, when I delete a single episode, Plex deletes the entire season? What does that have to do with episode naming? Especially when a re-scan picks up and correctly matches all episodes?

@boblinthewild said:
Before I change all these file names to put brackets in, help me understand why, when I delete a single episode, Plex deletes the entire season? What does that have to do with episode naming? Especially when a re-scan picks up and correctly matches all episodes?

I have no idea why Plex is deleting the whole season, but incorrect naming will cause all kinds of problems. If Plex scans and it doesn’t get a complete match, it may just delete everything. The first thing you need to do is fix all the incorrect naming, because without starting fresh and 100% naming compliant, it’s pretty hard to diagnose any other problems. Search around for almost any of JuiceWSA’s posts and you’ll find some great info for getting everything into compliance.

What kind of drive is D: ?

Are you using the DVR functions?
If so, are you recording with DVR into the same library where also your other tv shows are?

You have an awful lot of channels/plugins. Could you get rid of some of them (at least those which don’t work anyway?)

I’d be careful with exclamation marks in folder names. Particularly at the very beginning of the name.
I’d simply use an underscore instead.
I’m not saying it will cause trouble - it merely might.

May I take a look at the ‘Add Folders’ tab
when you ‘edit’ your tv show library (make a screenshot please) ?

Have you ever set the top 2 drop down selectors to anything else than shown in this screenshot?

@OttoKerner said:
What kind of drive is D: ?
Western Digital Black, internal, 5TB.

Are you using the DVR functions?
No.

If so, are you recording with DVR into the same library where also your other tv shows are?

You have an awful lot of channels/plugins. Could you get rid of some of them (at least those which don’t work anyway?)
I really don’t understand how that will help with this particular issue.

I’d be careful with exclamation marks in folder names. Particularly at the very beginning of the name.
I’d simply use an underscore instead.
I’m not saying it will cause trouble - it merely might.
There are no exclamation marks in the folder/file names


in question.

May I take a look at the ‘Add Folders’ tab
when you ‘edit’ your tv show library (make a screenshot please) ?
Screenshot attached. The first item in the folder list is the relevant one.

Have you ever set the top 2 drop down selectors to anything else than shown in this screenshot?
No. Those are the settings I’ve always used.

@boblinthewild said:
Western Digital Black, internal, 5TB.

formatted as NTFS, I hope?
(not ‘pooled’ with Windows storage spaces, using ReFS)

I really don’t understand how that will help with this particular issue.

I’ve seen cases where defunct plugins wreak havoc on a user’s library.

There are no exclamation marks in the folder/file names

you have a Movie folder that starts with an exclamation mark.

Screenshot attached. The first item in the folder list is the relevant one.

This looks all ordinary.

No. Those are the settings I’ve always used.

Good

I will need to add another pair of eyes to your logs, I think.

@OttoKerner said:
formatted as NTFS, I hope?
(not ‘pooled’ with Windows storage spaces, using ReFS)
Correct.

I’ve seen cases where defunct plugins wreak havoc on a user’s library.
I will look at what I can delete, but that seems like a stretch.

There are no exclamation marks in the folder/file names
you have a Movie folder that starts with an exclamation mark.
I don’t understand how that movie folder name affects what’s happening to my TV Shows library.

I’m getting set up to run a test with file names per the Plex recommendation:

TV Shows/ShowName/Season XX/ShowName - sXXeYY - Optional_Info.ext
Where:
XX is the season number
YY is the episode number
…Optional_Info is additional optional text (e.g. episode title) that is ignored by Plex.

Another Q:
your media drives are external or internal or … ?

Still not working. New logs attached. Here’s what I did:

  1. Named “Designated Survivor” folders and files per your suggestion and performed Plex Dance. Folder structure looked like this:

TV Shows/
Designated Survivor/
Season 01/
Designated Survivor - S01E16 - [WEB-DL RARBG].mp4
Designated Survivor - S01E16 - [WEBRip RARBG].mp4
Designated Survivor - S01E17 - [WEBRip RARBG].mp4
Designated Survivor - S01E18 - [WEB-DL RARBG].mp4
Designated Survivor - S01E19 - [WEBRip RARBG].mp4
Designated Survivor - S01E20 - [WEBRip RARBG].mp4

  1. Deleted “Designated Survivor - S01E16 - [WEB-DL RARBG].mp4” from the folder
  2. Added “Designated Survivor - S01E21 - [WEBRip RARBG].mp4” to the folder
  3. Updated the TV Shows library
  4. Plex marked the entire Season 01 for deletion (trashcan icon)
  5. Plex picked up the newly added episode 21 and added it to the season, even though the season is marked for deletion
  6. Emptied the trash and the season and show were deleted (show disappeared from library)
  7. Re-scanned the TV show library and all episodes reappeared

Conclusion - the file naming I was using before isn’t affecting Plex behavior with respect to additional episodes (indeed, entire shows) being incorrectly deleted.

@OttoKerner said:
Another Q:
your media drives are external or internal or … ?

External USB-3 drives. The drive in question (my H: drive) has been spinning regularly while I’ve done all these tests.

would you send me your database file after step5 has been executed?
(when step 6 and 7 have not been performed alredy)
send it as PM