Issues Emptying Trash

I’ve recently moved my library from macOS over to a Synology DS916+ and while that process was fairly smooth (followed these steps) I’m running into an issue with my Movie Library.

Plex won’t let me empty the trash for this section which is very annoying as I culled a large portion in the move. I’ve performed numerous updates on the section and it does see that these items are ready to be removed (they show as unavailable), but when I try to empty the trash for the Section, I get the error “There was a problem emptying the trash.”

If I manually delete the items in question, it works (9/10 times), but otherwise I’m stuck with a bunch of content I no longer have access to.

Any ideas on how I should proceed? I could simply delete the Movies section and re-create it but then I’d be losing all of my watch history which isn’t ideal (but if it’s the only solution, it’s the only solution)

Thanks!

  1. Have you ever used .plexignore files? If so, inspect them and remove path names from them which are no longer existing.

  2. Edit your library, go to the ‘Add Folders…’ tab and look for path references that are no longer in existence. Do also check if the path names end in either / or \. If so, remove them.

  3. last thing is to restart Plex Server, wait 3 minutes and then inspect the Plex Media Server.log file for mentions of database corrupt. If such a message appears in there, repair your database.

  1. I have used .plexignore files when the library was hosted on the Mac mini but they aren’t present now
  2. Checked the folders for all libraries and they only contain the new location of the files
  3. I’d pulled a copy of the logs earlier this morning and just checked. Looks like there is some corruption

Thanks for your help. Will try to repair and follow up if I’m still seeing the same issue

Definitely an issue here.

*** in database main ***
Page 4086: btreeInitPage() returns error code 11
On tree page 3 cell 5: Child page depth differs
Page 4042: btreeInitPage() returns error code 11
Page 4041: btreeInitPage() returns error code 11
Page 4040: btreeInitPage() returns error code 11
Page 4039: btreeInitPage() returns error code 11
Page 4038: btreeInitPage() returns error code 11
Page 4037: btreeInitPage() returns error code 11
Page 4036: btreeInitPage() returns error code 11
Page 4035: btreeInitPage() returns error code 11
Page 4034: btreeInitPage() returns error code 11
Page 4033: btreeInitPage() returns error code 11
Page 4032: btreeInitPage() returns error code 11
Page 4031: btreeInitPage() returns error code 11
Page 4030: btreeInitPage() returns error code 11
Page 4029: btreeInitPage() returns error code 11
Page 4028: btreeInitPage() returns error code 11
Page 4027: btreeInitPage() returns error code 11
Page 4026: btreeInitPage() returns error code 11
Page 4025: btreeInitPage() returns error code 11
Page 4024: btreeInitPage() returns error code 11
Page 4023: btreeInitPage() returns error code 11
Page 4022: btreeInitPage() returns error code 11
Page 4021: btreeInitPage() returns error code 11
Page 4020: btreeInitPage() returns error code 11
Page 4019: btreeInitPage() returns error code 11
Page 4018: btreeInitPage() returns error code 11
Page 4017: btreeInitPage() returns error code 11
Page 4016: btreeInitPage() returns error code 11
Page 4015: btreeInitPage() returns error code 11
Page 4014: btreeInitPage() returns error code 11
Page 4013: btreeInitPage() returns error code 11
On tree page 3 cell 4: Child page depth differs
Page 4043 is never used
Page 4044 is never used
Page 4045 is never used
Page 4046 is never used
Page 4047 is never used
Page 4048 is never used
Page 4049 is never used
Page 4050 is never used
Page 4051 is never used
Page 4052 is never used
Page 4053 is never used
Page 4054 is never used
Page 4055 is never used
Page 4056 is never used
Page 4057 is never used
Page 4058 is never used
Page 4059 is never used
Page 4060 is never used
Page 4061 is never used
Page 4062 is never used
Page 4063 is never used
Page 4064 is never used
Page 4065 is never used
Page 4066 is never used
Page 4067 is never used
Page 4068 is never used
Page 4069 is never used
Page 4070 is never used
Page 4071 is never used
Page 4072 is never used
Page 4073 is never used
Page 4074 is never used
Page 4075 is never used
Page 4076 is never used
Page 4077 is never used
Page 4078 is never used
Page 4079 is never used
Page 4080 is never used
Page 4081 is never used
Page 4082 is never used
Page 4083 is never used
Page 4084 is never used
Page 4085 is never used
Page 4087 is never used
Page 4088 is never used
Page 4089 is never used
Page 4090 is never used
Page 4091 is never used
Page 4092 is never used
Page 4093 is never used
Page 4094 is never used
Page 4095 is never used
Page 4096 is never used
Page 4097 is never used
Page 4098 is never used
Page 4099 is never used
Page 4100 is never used
Page 4101 is never used
Page 4102 is never used
Page 4103 is never used
Page 4104 is never used
Page 4105 is never used
Page 4106 is never used
Page 4107 is never used
Page 4108 is never used
Page 4109 is never used
Page 4110 is never used```

Trying to repair now

the principal instructions for a database repair are here:

But for newer versions of the SQLite3 software, the 4 command line instructions need an update:

OSX
---
sqlite3 ~/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "PRAGMA integrity_check"

sqlite3 ~/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db .dump > dump.sql

mv ~/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db ~/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db.original

sqlite3 ~/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db < dump.sql

Thanks for that. Followed the steps on the Linked page yesterday and all back to normal. I can now Empty the Trash on all sections and Plex is working normally. Thanks

I am having this issue as well and the db repair did not help. also i am not using any .plexignore files. All i did was move the files from 1 directory to another and i started getting duplicates and 1 says unavailable and the other is fine but empty trash will not remove the old path. On a windows server. over 400 files right now have this issue and i do not want to go through and remove then manually 1 at a time. is there another way to get empty trash to work?

What about 2) in my first response above?

If that doesn’t help, you’ll have to burn this library and start over, I’m afraid.

no path names end in a slash, so you are saying the DB is hosed?
based on past experience SQLite is meant for small databases and if it becomes overcrowded there are performance issues like this. With this being the case what is the recommend library size? as far as number of items? I would be willing to move to another database structure if that is possible. even if it is unsupported i would be willing to try.

@arnie311 said:
no path names end in a slash, so you are saying the DB is hosed?

It may be.

If you have far more items in your library than the affected 400 items, I’d say the smaller evil is to Plex Dance the affected 400 items.
This will delete them from the Plex library as if they were never there.
Then they can be added afresh.

based on past experience SQLite is meant for small databases and if it becomes overcrowded there are performance issues like this.

What is your library size? There are users with extremely big libraries and no issues.

Before going crazy trying to fix this.
You know how to check the database with “PRAGMA integrity_check”.

In web go to /settings/server/Scheduled Tasks and you’ll see an option called “Backup directory”
This location will hopefully contain a couple of backup database.
If present COPY them to a different location and one by one rename them to
com.plexapp.plugins.library.db

Then run the pragma test on them.
Do any of these databases pass or are they also corrupted?

Carlo


@OttoKerner here is the library size for items (it seems large to me but no idea if this is “extremely large”

@cayars none of them are corrupted thats the thing, even the current one is good and I went ahead and ran the dump/rebuild on it and no fix.

I will try the plex dance and see if that works

Humor me:
Create a new directory such as c:\MovieTest
Copy a few movies into this directory (5 to 10). Pick movies you have seen and ones you have not seen (a mix).

Now create a new Library such as MovieTest and point it to this new location
Scan this new library. Once complete go into this library and look at the movies.

Did it carry over your watched status or does everything show as unwatched?

Carlo

It kept the watch status of everything

@cayars any advise? What are you trying to determine from that test?

@arnie311, I didn’t see your response on the 4/21. The forums are acting a bit strange with notifications and read status.

From the test i wanted to see if basic functionality was working based on something I’ve seen before. You passed so this is good.

With only 400 movies files I would think the easy thing to do/test would be to:

  1. Create a new Movies library (eg Movies2) pointed at the exact same location your present movie database is pointed to.
  2. After scanning this new library check it to make sure there is no dead links.
  3. Now lets do another test. Move a movies out of it’s present path so plex can’t find it.
  4. Rescan your Movie2 library.

Check that movie and it should show a dead link. Now try and empty the trash.
Did it work correctly? Is the movie gone?

If things are working correctly for Movies2 then the easiest thing is to DELETE Movies lib and then rename Movies2 to Movies. Do an empty trash, clean bundles, optimize database.

Then go check your SHARES to make sure users have access to this “new” Movies library.

If it fails at any point, shoot me a PM with a link back to this thread. I’ll see if I can remotely help you with something like TeamViewer this weekend to help you get it straightened out.

Carlo

PS Post your results here.