Deleted file still shows in smart playlist

Server Version#: 1.42.2.10122
Player Version#: 4.152.0 (plex web), 4.12.4 (plexamp).

I have a smart playlist of my oldest unplayed songs (Track rating is unrated. Track plays is 0. Sorted by date added - oldest first).

However, I have a ‘missing’ song stuck at the top of this list, which shows on Plex Web, Plexamp, and Plex for Windows, but doesn’t play on any of them.

The mp3 file no longer exists - I deleted it and the folder it was in whilst trying to solve this, but this hasn’t resolved the issue.

When I view the playlist, the song shows at the top of this list. If I click on ‘Get Info’, the file shows as ‘Unavailable’. If I click on ‘Delete file’, the error message says ‘There was a problem deleting this file’.

When I play the playlist, the song doesn’t play (because it no longer exists in my filesystem). However, even when it did exist in the file system, it didn’t play.

When I edit the filters, the song does not show in the list. However, when I update the playlist, it shows again at the top of the playlist.

I have tried rescanning my library files. I have tried refreshing all metadata. I also tried re-adding a file with the same name and location, scanning library files, then deleting the file and scanning again. However, the problem remains.

The filename doesn’t have anything out of the ordinary (all standard characters etc).

If I try to access the song via the artist, no songs show up on the artist page. (I have no other songs by the artist).

Any suggestions for how to fix it? Thanks in advance.

Make sure you have Empty trash automatically after every scan enabled in Plex Settings > Server > Library, then scan the library.

Then Optimise Database in Plex Settings > Server > Troubleshooting.

Then restart Plex on the NAS.

With a little luck, that should remove the errant file from the smart playlist.

Thanks for the help @trumpy81.

’Empty trash automatically’ was already checked. (I can delete other files fine, and empty the trash).

I optimised the database as you selected, restarted Plex on the NAS, and then rescanned the library files.

Unfortunately, the errant file is still there.

Have you tried deleting the smart playlist and then recreating it after the file was deleted?

Is the file stuck in a recycle bin somewhere on the NAS?

I have deleted the playlist and recreated it. The problem remains.

I have checked the recycle bins on the NAS, emptied them. The problem remains.

I have also tried putting a different MP3 file with the same name and location, plus the same ID3 tags. This will change the length of the file showing in the smart playlist. However, this file can’t be played within Plex, and can’t be deleted via Plex. Deleting it via the NAS doesn’t fix the issue either.

Any other help greatly appreciated!

The only thing I can think of, would be to repair your database.

See this link DBRepair - ChuckPa

Download and move the script file to your NAS, SSH into the NAS and run the commands that Chuck shows on his page.

I don’t know if that will fix things for you or not, but fingers crossed it may help.

You could also try restoring a database backup, but I am guessing the problem has existed for some time and the backups may have the same issue present.

https://support.plex.tv/articles/202485658-restore-a-database-backed-up-via-scheduled-tasks/