I’ve been updating some TV series with new files, and now a few of my series and their respective seasons show the red trash can icon even though no files are missing and all episodes have only one file associated with them. As mentioned in this topic, I’ve also emptied trash, updated metadata, and optimized the database. Any ideas on what to do?
As an example, season 3 of The Sopranos shows a red trash can icon. I can play all episodes of the season via multiple clients without issue, so to me, it doesn’t seem to be a permissions problem. I’ve confirmed that all episodes can be played for all problematic seasons across the three shows experiencing this problem.
Are you referring to something different when you say Plex cannot see/read the files? There is no difference in permissions across the season folders for the show, and the other seasons don’t show the trash icon.
After some further searching around, I pieced together a couple of topics and was able to fix this with some manual database editing, as it appears to be a bug where the deletedAt attribute doesn’t get cleared sometimes, which causes the trash icon to show up for a season or show.
First, I found this topic, but because it’s so old, and the SQLite db has been extended by Plex since then, I needed to follow steps from this post here. Here’s what I did, step by step, and it worked like a charm. Of course, you are manually editing a database, so there’s risk of all kinds of problems, so beware, and BACKUP your database before attempting.
BACKUP YOUR DATABASE: You can download a copy to your machine under
Under Database Structure, scroll all the way down to triggers delete the following triggers: fts4_metadata_titles_before_update_icu fts4_metadata_titles_after_update_icu
Write changes
Under Execute SQL, you’ll execute the following command, where id = the season id number. This can be found by clicking on the Unavailable button on the Season page, clicking View XML, and searching for ratingKey=#####. You’ll want to execute this command for each of the seasons that are showing the trash icon. This can also be confirmed in the season/show XML, where you’ll find a deletedAt attribute with a Unix time number. Normal seasons/shows do not have this set. We’re setting it to back NULL. You may also need to do this at the show level, entering the show id number, which is listed on the season XML under parentRatingKey=#####. UPDATE metadata_items SET deleted_at = NULL WHERE id = #####;
Now to restore the triggers we deleted in order to be able to edit the database outside of Plex. Under Execute SQL, run the following commands, one at a time. You’ll get an error if you try to do them both at once.
CREATE TRIGGER fts4_metadata_titles_before_update_icu BEFORE UPDATE ON metadata_items BEGIN DELETE FROM fts4_metadata_titles_icu WHERE docid=old.rowid; END
CREATE TRIGGER fts4_metadata_titles_after_update_icu AFTER UPDATE ON metadata_items BEGIN INSERT INTO fts4_metadata_titles_icu(docid, title, title_sort, original_title) VALUES(new.rowid, new.title, new.title_sort, new.original_title); END
Verify that the triggers are back in place under Database Structure by scrolling all the way down again.
Write changes, and then close the database.
Make another backup of your original database by renaming com.plexapp.plugins.library.db to something with a descriptive title, like com.plexapp.plugins.library.db-before-edit
Copy your edited database into place, making sure the name is exactly com.plexapp.plugins.library.db.
Start Plex Media Server up again, and verify your seasons look good. I hope they do! Mine did!
Here you go. Scanned files, emptied trash, cleaned bundles, downloaded logs.
In my case, my media library is mostly symlinks to the original files so the symlinks can be named appropriately for Plex. What I did this time was to delete the season folders under the show folder (eg. deleted Season 01-06 under The Sopranos/) and then had FileBot recreate the symlinks to the new underlying files. The server is set to recognize filesystem changes and rescan those folders, so when FileBot recreated the symlinks, PMS almost immediately recognized that files were back for most of the shows I was working on, except for the ones below, with metadata_item IDs as follows: 14458, 18092, 16379, 16430, 18095, 14459 Plex Media Server Logs_2023-08-09_21-31-28.zip (1.4 MB)
Aug 09, 2023 21:16:46.785 [140625331116856] DEBUG - Scanner: Processing directory /volume2/Media/TV Shows/Archer (2009)/Specials (parent: yes)
Aug 09, 2023 21:16:46.789 [140625331116856] ERROR - Couldn't get size of file "/volume2/Media/TV Shows/Archer (2009)/Specials/Archer (2009) - S00E04 - Heart of Archness - Part I.mkv": boost::filesystem::file_size: No such file or directory [system:2]: "/volume2/Media/TV Shows/Archer (2009)/Specials/Archer (2009) - S00E04 - Heart of Archness - Part I.mkv"
Aug 09, 2023 21:16:46.789 [140625331116856] ERROR - Couldn't get size of file "/volume2/Media/TV Shows/Archer (2009)/Specials/Archer (2009) - S00E05 - Heart of Archness - Part II.mkv": boost::filesystem::file_size: No such file or directory [system:2]: "/volume2/Media/TV Shows/Archer (2009)/Specials/Archer (2009) - S00E05 - Heart of Archness - Part II.mkv"
Aug 09, 2023 21:16:46.789 [140625331116856] ERROR - Couldn't get size of file "/volume2/Media/TV Shows/Archer (2009)/Specials/Archer (2009) - S00E06 - Heart of Archness - Part III.mkv": boost::filesystem::file_size: No such file or directory [system:2]: "/volume2/Media/TV Shows/Archer (2009)/Specials/Archer (2009) - S00E06 - Heart of Archness - Part III.mkv"
In the 2nd set, it’s more clear .
Unfortunately PMS isn’t printing “Permission Denied” as it used to.
– No such file is an euphemism for “permission denied”.
– It can read the names from the directory but not descend any deeper (the files themselves)
Have you forcibly reapplied permissions (Apply to this folder, sub-folders, and files) for granting permission to the media ?
Those files were actually not there, as I just recently deleted them. And PMS handled it correctly when I emptied the trash, by removing the files from the metadata item and leaving the season as complete because the files were replaced by others. However, to be clear, that show/season never had this problem that I’m describing. The Sopranos S03 was one of the problematic seasons.
Yes, I’ve forcibly reapplied permissions, and PlexMediaServer user has full read/write access to the whole Media share, which is above all of the files I have in Plex, whether as actual files or symlinked files.
Can you please clarify what permissions mean for Plex in this case? If Plex can get info, read, and play the file, does that mean it has appropriate permissions? Because that is the case for all of the problematic seasons/shows I was talking about, it saw the files, knew all of the media info, and could play them without issue.