Bug: Plex scanner may ignore or destroy directory depending on contents

For debugging, I tried renaming Chivalry_of_a_Failed_Knight to Chivalry_of_a_Failed_Knight-{tvdb-299506}, as per the instructions here: https://support.plex.tv/articles/naming-and-organizing-your-tv-show-files/

  • If you are using the “Plex TV Series” agent, you can optionally include the TMDB or TVDB show ID in the folder name to improve matching. If you choose to do that, it must be inside curly braces: ShowName (2020) {tvdb-123456} or ShowName (2020) {tmdb-123456} where 123456 is the show ID. An example can be found at the end of the article.

This does not fix the issue. Is including the TVDB ID in curly braces as described above sufficient for naming? Or is that being ignored for some reason? If I do go full spaces and parenthesis it works. Now I’m a bit concerned that for my other libraries (where I can rename things) if there is any difference in the filename and the expected filename (for example if TVDB updates the year of the show which does happen) that the show won’t show up.

The tvdb or tmdb id helps match it to the correct show

Because of the naming Plex thinks there’s no file there at all

There’s nothing to match

@ChuckPa If what JaysPlex7 said above is correct, is this a bug? Or intended? And if it is intended, why is it ignoring the d with {tvdb-123456} in the name and what setting do I change to make it show up in the library as matched or unmatched- just so it shows up in the first place.

I can see in the logs that plex can see the series and even start analyzing it if there are certain changes in the directory but it will be deleted on a successive scan. It is named with {tvdb-299506} in the title. I don’t know why it sees the files initially but then decides to ‘Removing 13 media items that were left.’ and delete each ‘media item’. The second scan doesn’t even seem to scan the directory, it isn’t listed as being skipped or anything it just isn’t in the logs before it is purged.

All I can tell you is that when you use unsupported naming formats you get erratic and unpredictable results

My guess is just that, a guess. But I would be very surprised if anyone will ever be able to tell you with exact certainty why this won’t work the way you want

You can get away with bad naming for a long time in some cases. Unfortunately, as you acquire more and more media these problems seem to snowball until you’re dealing with it on a regular basis

I suppose there could be some kind of bug with the plexmatch file but I don’t use those so I can’t really speak to that

1 Like

Just in case I tried adding the tvdb tag to both the show directory and the episode name, but still the show only matches for a moment before it entirely vanishes from plex after another scan of the library. Anyway, my questions from my previous posts remain:

  1. Is it a bug that these shows are not showing up in plex at all (not even as unmatched)? I have tried .plexmatch files as well.
  2. Is naming shows with their TVDB ID in their names as described https://support.plex.tv/articles/naming-and-organizing-your-tv-show-files/ insufficient for generating a match? Note that the plex library is also specified to use TVDB as the source for its metadata and such. The link seems to indicate it is sufficient but if not I’m a bit worried as TVDB names do change from time to time so if this is not a bug then I don’t want files disappearing silently from my plex library if the TVDB updates the name of something, and plex just secretly removes it from the library rather than labeling it as unmatched.
  3. Why do the shows show up after the first scan, but vanish from the plex library after a second scan? Why do they show up again if I edit the file names but disappear after the next scan?
  4. If this is not a bug, how can I fix this? I am testing .nfo files but have not yet had any luck. I have tried .plexmatch files as well. I’d manually set the metadata if the show showed up in plex it all (though everytime it does it is properly matched). Is there a library setting keeping these hidden?

Also, I can see that it is matching every single time it appears, and if it were not matching I’d assume it’d appear as unmatched? I’m not sure if this is a matching issue, the logs seem to show it matching just fine:

[MetadataAgent/tv.plex.agents.series] Found 1 provider matches for 'Chivalry of a Failed Knight {Tvdb 299506}'.
Scanner [Plex TV Series]: found cloud match for file '/anime/Chivalry_of_a_Failed_Knight-{tvdb-299506}/Season_01/Chivalry_of_a_Failed_Knight-{tvdb-299506}-S01E01, The_Worst_One_I-[Doki-Bluray-1080p].mkv': 'Chivalry of a Failed Knight'
Native Scanner: Executed Cloud Match stage in 0.52 sec.

It is matching, it is just then deleted by plex, but even in the deletion logs you can see the metadata has properly pulled as the episodes are named and the series is named:

Destroying metadata item 90633 (Failed Knight I)
Updating deletion state for metadata item 90632, is has a dead item count of 0.
Updating deletion state for metadata item 90631, is has a dead item count of 0.
[LibraryTimeline] Scanner activity on section 5: 0 added, 1 deleted
Deleting media item 146712.
...
Destroying metadata item 90632 (Season 1)
Destroying metadata item 90631 (Chivalry of a Failed Knight)
[LibraryTimeline] Scanner activity on section 5: 0 added, 13 deleted
Removing 2 directories that were left.
Deleting directory [Chivalry_of_a_Failed_Knight-{tvdb-299506}] (8925)
[LibraryTimeline] Scanner activity on section 5: 0 added, 14 deleted
Deleting directory [Chivalry_of_a_Failed_Knight-{tvdb-299506}/Season_01] (8926)

Does the series remain, if you use a fake file and name it like an episode that never existed? e.g. s03e01

This is not a valid name format. Get rid of the underscores.
It is a pain when renaming by hand to use `“Multi Word Title” but if that’s what the series title is then that’s what we use.

The valid format is:
Chivalry of a Failed Knight {tvdb-299506} - SxxExx - optional title.ext

A similar case to this is “ST:TNG” vs “Star Trek: The Next Generation”.

While we know what it means, the automation does not and won’t find any results.

On the “Naming and Organizing your tv show files” page, the names do not have underscores. They are clean.

/TV Shows
   /Doctor Who (1963)
      /Season 01
         Doctor Who (1963) - s01e01 - An Unearthly Child (1).mp4
         Doctor Who (1963) - s01e02 - The Cave of Skulls (2).mp4

PMS can parse a lot but it must meet minimal standards.

While you say this is not your drive and you can’t change the naming,

Can you copy it onto something you do own and can effect the proper renaming rather than trying to force it as a test ?

1 Like

It shows up but vanishes after another scan usually.

@ChuckPa I can; my concern is not that this show is being ignored, my concern is that plex is entirely ignoring files altogether. With a library of over 20,000, I’m concerned about what else might be ignored / might become ignored / might be ignored if added in the future. That’s why I have been persistent in asking if this is a bug because the fact that it does not show up at all in plex, even as unmatched, is unnerving me.

For example, TVDB just updated the name of The Family Circumstances of the Unreliable Witch to The Family Circumstances of the Irregular Witch. Which would mean that the names of the file no longer match the names the library’s metadata db use. In the past this wouldn’t be an issue, I could just fix the match in plex manually since the show would show up as unmatched. But if plex is going to suddenly start ignoring the existence of files it’s concerning. Many name changes are a lot more extreme and can be quite different.

I was hoping that appending {tvdb-424530} onto the name would be sufficient, as even though the name changes on TVDB the ID does not, but this either does not appear to be the case, or it is indeed the case and what I am seeing is a bug in PMS causing it to ignore the existence of these files.

If this is a bug, the solution is easy: I can copy over this one directory of files and any other missing items I find, rename them, and hope the bug gets patched soon and plex starts showing me all of my library as I expected it to do (even if unmatched in which case I can create a .plexmatch file). If this is intended behavior, however, I’d like to know why it is happening and more about it so I can mitigate this somehow.

If it lingers long enough for you to enter the properties of the show, check what is set on the Advanced tab for “Keep” as well as “Delete episodes after playing”.

@OttoKerner I’m not sure if there is a misunderstanding, but to be clear plex is not deleting the media files nor is this an issue of plex not keeping the episodes downloaded or anything. This is an issue of the files appearing to not exist in plex at all. I assume the 'destroy’d directories in the logs are metadata / internal to plex, they are not the media files themselves.

@ChuckPa Does my response to your post make sense or is further clarification needed?

@zwimer

I understand your response.

Searching for “The Family Circumstances of the Unreliable Witch” returns no results.
I think you have the name incorrect.

I was able to find “unreliable” as an alternate name for the proper title “irregular”

To demonstrate the issue is with how your media files are named, I just now, created “The Family Circumstances of the Irregular Witch” (1 season only)

[chuck@lizum ~.1991]$ make-series "The Family Circumstances of the Irregular Witch" 1 20
Making "The Family Circumstances of the Irregular Witch/Season 01"
Done
[chuck@lizum ~.1992]$ ls -la /glock/qa/tv/The\ Family\ Circumstances\ of\ the\ Irregular\ Witch/
total 60
drwxr-xr-x   3 chuck chuck    31 Nov 30 09:26 ./
drwxr-xr-x 967 chuck chuck 32768 Nov 30 09:26 ../
drwxr-xr-x   2 chuck chuck  4096 Nov 30 09:26 Season 01/
[chuck@lizum ~.1993]$ ls -la /glock/qa/tv/The\ Family\ Circumstances\ of\ the\ Irregular\ Witch/Season\ 01/
total 84
drwxr-xr-x 2 chuck chuck 4096 Nov 30 09:26 ./
drwxr-xr-x 3 chuck chuck   31 Nov 30 09:26 ../
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E01.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E02.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E03.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E04.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E05.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E06.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E07.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E08.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E09.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E10.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E11.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E12.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E13.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E14.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E15.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E16.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E17.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E18.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E19.mkv
-rw-r--r-- 1 chuck chuck  342 Nov 30 09:26 The Family Circumstances of the Irregular Witch - S01E20.mkv
[chuck@lizum ~.1994]$ 

Without any special match “forcing” , PMS quickly and correctly matched the series.

I understand your reluctance to do the work of verifying all the naming for all your content but, if you want PMS to work correctly, it must be done.

When I first started, my naming was all over the place and didn’t work well either.
The instant I started using the naming from TMDB / TVDB, it all immediately came together.

I sincerely urge you to invest in a renaming tool (I use FileBot and will give you my renaming rules to help)

With these tools, you can slowly work your way through your media files, say 20-30 series at a time (or more as your confidence / familiarity grows) until you have it all verified. I can verify & rename 30 series in less than a minute ( the drag & drop from the file browser takes the most time )

For all new media, use the renaming tool BEFORE it gets added to PMS and you won’t have this problem unless there truly is a metadata problem.

@ChuckPa As advised above, I have since copied the trouble files to my own library and named them properly and they show up in the library, so I’m not concerned with this particular show now.

Instead now I’d like plex to show me unmatched series and episodes instead of pretending they don’t exist and hiding them. I believe this is a feature, allowing unmatched files in a library to exist? How do I do that?

Go into any library (making sure you’re on the library tab) and there should be some filters in the top left corner. Click on ‘All’ and then select ‘Unmatched’ from the drop down.

I did that. The media does not seem to exist at all in the library. It is not marked as unmatched, it is just not present.

@zwimer

Open a terminal window and ‘cd’ to the directory containing the series (top most directory)

Next, please show a ls -la as I have above.

Lastly, using your mouse, highlight the text in the terminal window and Right-Click “COPY”.

PASTE that text here for me to see.

$ ls -laR .
.:
total 0
drwxrwxr-x 1 sonarr sonarr    18 Nov 30 10:52  .
drwxrwxr-x 1 sonarr sonarr 37596 Nov 30 10:50  ..
drwxrwxr-x 1 sonarr sonarr  2050 Nov 30 10:46 'Season 01'

'./Season 01':
total 9065380
drwxrwxr-x 1 sonarr sonarr      2050 Nov 30 10:46  .
drwxrwxr-x 1 sonarr sonarr        18 Nov 30 10:52  ..
-rw-rw-r-- 1 sonarr sonarr 754118524 Nov 17 06:45 'Chivalry of a Failed Knight - S01E01 - The_Worst_One_I-[Sonarr-Bluray-1080p].mkv'
-rw-rw-r-- 1 sonarr sonarr 750846682 Nov 17 06:45 'Chivalry of a Failed Knight - S01E02 - The_Worst_One_II-[Doki-Bluray-1080p].mkv'
-rw-rw-r-- 1 sonarr sonarr 724288136 Nov 17 06:45 'Chivalry of a Failed Knight - S01E03 - The_Worst_One_III-[Doki-Bluray-1080p].mkv'
-rw-rw-r-- 1 sonarr sonarr 911413495 Nov 17 06:45 'Chivalry of a Failed Knight - S01E04 - The_Worst_One_IV-[Doki-Bluray-1080p].mkv'
-rw-rw-r-- 1 sonarr sonarr 679138028 Nov 17 06:45 'Chivalry of a Failed Knight - S01E05 - The_Experience_of_the_Princess-[Doki-Bluray-1080p].mkv'
-rw-rw-r-- 1 sonarr sonarr 680930681 Nov 17 06:45 'Chivalry of a Failed Knight - S01E06 - Sword_Eater_I-[Doki-Bluray-1080p].mkv'
-rw-rw-r-- 1 sonarr sonarr 729970859 Nov 17 06:45 'Chivalry of a Failed Knight - S01E07 - Sword_Eater_II-[Doki-Bluray-1080p].mkv'
-rw-rw-r-- 1 sonarr sonarr 772070533 Nov 17 06:45 'Chivalry of a Failed Knight - S01E08 - Sword_Eater_III-[Doki-Bluray-1080p].mkv'
-rw-rw-r-- 1 sonarr sonarr 736837332 Nov 17 06:45 'Chivalry of a Failed Knight - S01E09 - Princess'\''_Vacation-[Doki-Bluray-1080p].mkv'
-rw-rw-r-- 1 sonarr sonarr 830749813 Nov 17 06:45 'Chivalry of a Failed Knight - S01E10 - Witch_of_the_Deep_Ocean_vs_Raikiri-[Doki-Bluray-1080p].mkv'
-rw-rw-r-- 1 sonarr sonarr 964241470 Nov 17 06:45 'Chivalry of a Failed Knight - S01E11 - Another_One-_The_Uncrowned_Sword_King_I-[Doki-Bluray-1080p].mkv'
-rw-rw-r-- 1 sonarr sonarr 748319431 Nov 17 06:45 'Chivalry of a Failed Knight - S01E12 - Another_One-_The_Uncrowned_Sword_King_II-[Doki-Bluray-1080p].mkv'

If this doesn’t match the naming convention for “Chivalry of a Failed Knight”, then it should show up as a different unmatched series. It is not showing up whatsoever, however. For reference, that user/group is the same as every other media file on my server.

Here is “WebTools NG”.

It’s written and maintained by a Plex Employee.

In it, you will find the “Find Unmatched” function. This will give you the list of unmatched media file by file.

Releases are here: Releases · WebTools-NG/WebTools-NG · GitHub

1 Like

To add to my above,

In the Library view,

Change “ALL” to “Unmatched”. (dropdown)
next change the display to whichever granularity you like.

Here you can see where my test library ‘runs off the end’ of legitimate series.
The non-existent / unmatched episodes show here.