Maintainerr icon indicating copy to clipboard operation
Maintainerr copied to clipboard

Show does not delete after "Take action after days" = 0

Open truncsphere opened this issue 1 year ago • 21 comments

Describe the bug I have a rule that deletes stale shows that haven't been watched in over 1 year. Currently 2 shows fit this description. I have watched the countdown reach 0 twice and neither time did it delete the show. Instead the logs show it's been removed from the collection and then it re-adds and restarts the timer.

Expected behavior To delete said shows after 30 days.

Screenshots image

Device (please complete the following information):

  • Maintainerr version 2.0.4

Other notes I have a rule to delete movies not watched after X years and it removes these with no issues.

truncsphere avatar Jun 21 '24 19:06 truncsphere

Also have the same problem, running on both older versions and the most recent version. The logs aren't overly helpful. I can see there's a problem but it's just logging out a generic error.

[maintainerr] | 22/06/2024 03:49:52  [WARN] [OverseerrGetterService] Couldn't get addUser from Overseerr
[maintainerr] | 22/06/2024 03:49:52  [DEBUG] [OverseerrGetterService] Cannot read properties of undefined (reading 'seasonNumber')
[maintainerr] | 22/06/2024 03:50:04  [DEBUG] [undefined] GET request failed: AxiosError: Request failed with status code 500
[maintainerr] | 22/06/2024 03:50:04  [WARN] [OverseerrGetterService] Couldn't get addUser from Overseerr
[maintainerr] | 22/06/2024 03:50:04  [DEBUG] [OverseerrGetterService] Cannot read properties of undefined (reading 'seasonNumber')
[maintainerr] | 22/06/2024 03:50:12  [DEBUG] [undefined] GET request failed: AxiosError: Request failed with status code 500

adampetrovic avatar Jun 22 '24 03:06 adampetrovic

Hey, something else re-adds the media. Mostly this is a due to Overseerr’s auto watchlist download feature. Make sure something like that isn’t enabled

jorenn92 avatar Jun 22 '24 08:06 jorenn92

Overseerr works off the Plex Watchlist. None of these items are on that list.

screenshot_2024_06_22_19_07_43

adampetrovic avatar Jun 22 '24 09:06 adampetrovic

I don't use watchlists with Overseer so the media is not being re-added. It never gets deleted.

truncsphere avatar Jun 22 '24 13:06 truncsphere

Any update on this issue?

truncsphere avatar Jul 09 '24 14:07 truncsphere

Hey, Sorry for the late reply. I haven't seen any related reports and haven't been able to replicate this myself. So i'm actually unsure what's going on. Do you happen to have logs from Plex, Sonarr, and perhaps Overseerr during the deletion timeframe?

I think it has something to do with a failure to fetch the tvdb id, which is used for removal through Sonarr. Altough it should log a message when this is the case.

This error is due to a failure while fetching the tvdb ID from tmdb. But there are a few fallback mechanisms, so it's possible one of those did find the ID. [maintainerr] | 22/06/2024 03:50:12 [DEBUG] [undefined] GET request failed: AxiosError: Request failed with status code 500

jorenn92 avatar Jul 16 '24 14:07 jorenn92

So this just happened to happen again this morning. Shows got removed by Maintainer, but are still on Plex. The shows were re-added and the counter started again at 30 days.

I check Sonarr logs and didn't see anything around the time these were supposed to be deleted. The closest I found was below 2024-07-16 08:58:47.8|Info|RefreshEpisodeService|Starting episode info refresh for: [341164][Yellowstone (2018)] 2024-07-16 08:58:48.4|Info|RefreshEpisodeService|Finished episode refresh for series: [341164][Yellowstone (2018)]. 2024-07-16 08:58:48.4|Info|DiskScanService|Scanning Yellowstone (2018) 2024-07-16 08:58:48.4|Info|DiskScanService|Completed scanning disk for Yellowstone (2018)

Overseer shows the following image

However these are just refreshes and nothing re-downloaded to my server.

truncsphere avatar Jul 17 '24 15:07 truncsphere

I pushed a few changes that might fix your issue. If not, it'll hopefully log more 'debug' level info this time,

You can try it out with the 'ghcr.io/jorenn92/maintainerr:main' image. This image gets build after each git change. I don't recommend to stay on it for long, since this image might not stay stable, and after big changes you might not always be able to roll back to the latest release version. However, for now it'll be safe.

jorenn92 avatar Jul 18 '24 08:07 jorenn92

I pushed a few changes that might fix your issue. If not, it'll hopefully log more 'debug' level info this time,

You can try it out with the 'ghcr.io/jorenn92/maintainerr:main' image. This image gets build after each git change. I don't recommend to stay on it for long, since this image might not stay stable, and after big changes you might not always be able to roll back to the latest release version. However, for now it'll be safe.

I just installed the main version. Will let you know in 4 days what happens.

truncsphere avatar Jul 18 '24 16:07 truncsphere

@jorenn92 Unfortunately the same thing is occurring. Here is what the logs show.

[maintainerr] | 22/07/2024 00:00:00  [INFO] [TasksService] Task Collection Handler is waiting for task Rule Handler to finish...
[maintainerr] | 22/07/2024 00:00:01  [INFO] [RuleExecutorService] Executing rules for ' To be Deleted'
[maintainerr] | 22/07/2024 00:00:05  [INFO] [RuleExecutorService] Execution of rules for ' To be Deleted' done.
[maintainerr] | 22/07/2024 00:00:05  [INFO] [RuleExecutorService] Synced collection ' To be Deleted' with Plex
[maintainerr] | 22/07/2024 00:00:05  [INFO] [RuleExecutorService] Executing rules for 'Stale Shows'
[maintainerr] | 22/07/2024 00:00:08  [INFO] [RuleExecutorService] Execution of rules for 'Stale Shows' done.
[maintainerr] | 22/07/2024 00:00:08  [INFO] [RuleExecutorService] Synced collection 'Stale Shows' with Plex
[maintainerr] | 22/07/2024 00:00:11  [INFO] [CollectionWorkerService] Start handling all collections
[maintainerr] | 22/07/2024 00:00:11  [INFO] [CollectionWorkerService] Handling collection ' To be Deleted'
[maintainerr] | 22/07/2024 00:00:11  [INFO] [CollectionWorkerService] Handling collection ' To be Deleted' finished
[maintainerr] | 22/07/2024 00:00:11  [INFO] [CollectionWorkerService] Handling collection 'Stale Shows'
[maintainerr] | 22/07/2024 00:00:11  [INFO] [CollectionsService] Removing media with id 309852 from collection..
[maintainerr] | 22/07/2024 00:00:16  [INFO] [SonarrApi] Unmonitored season(s)  from Sonarr show with ID 180
[maintainerr] | 22/07/2024 00:00:16  [INFO] [CollectionWorkerService] [Sonarr] Unmonitored show 'The Rig (2023)' and removed all episodes
[maintainerr] | 22/07/2024 00:00:16  [INFO] [CollectionsService] Removing media with id 308105 from collection..
[maintainerr] | 22/07/2024 00:00:16  [INFO] [PlexApiService] Removed collection from Plex
[maintainerr] | 22/07/2024 00:00:18  [INFO] [SonarrApi] Unmonitored season(s)  from Sonarr show with ID 129
[maintainerr] | 22/07/2024 00:00:18  [INFO] [CollectionWorkerService] [Sonarr] Unmonitored show 'Yellowstone (2018)' and removed all episodes
[maintainerr] | 22/07/2024 00:00:18  [INFO] [CollectionWorkerService] Handling collection 'Stale Shows' finished
[maintainerr] | 22/07/2024 00:00:25  [INFO] [CollectionWorkerService] All collections handled. Triggered Overseerr's availability-sync because media was altered
[maintainerr] | 22/07/2024 04:20:00  [INFO] [RuleMaintenanceService] Starting maintenance
[maintainerr] | 22/07/2024 04:20:01  [INFO] [RuleMaintenanceService] Maintenance done
[maintainerr] | 22/07/2024 08:00:00  [INFO] [RuleExecutorService] Starting Execution of all active rules
[maintainerr] | 22/07/2024 08:00:02  [INFO] [RuleExecutorService] Executing rules for ' To be Deleted'
[maintainerr] | 22/07/2024 08:00:08  [INFO] [RuleExecutorService] Execution of rules for ' To be Deleted' done.
[maintainerr] | 22/07/2024 08:00:08  [INFO] [RuleExecutorService] Synced collection ' To be Deleted' with Plex
[maintainerr] | 22/07/2024 08:00:08  [INFO] [RuleExecutorService] Executing rules for 'Stale Shows'
[maintainerr] | 22/07/2024 08:00:11  [INFO] [RuleExecutorService] Adding 2 media items to 'Stale Shows'.
[maintainerr] | 22/07/2024 08:00:11  [WARN] [PlexApiService] Couldn't find collection with id 321689
[maintainerr] | 22/07/2024 08:00:11  [INFO] [CollectionsService] Creating collection in Plex..
[maintainerr] | 22/07/2024 08:00:11  [INFO] [CollectionsService] Adding media with id 309852 to collection..
[maintainerr] | 22/07/2024 08:00:11  [INFO] [CollectionsService] Adding media with id 308105 to collection..
[maintainerr] | 22/07/2024 08:00:11  [INFO] [RuleExecutorService] Execution of rules for 'Stale Shows' done.
[maintainerr] | 22/07/2024 08:00:11  [INFO] [RuleExecutorService] Synced collection 'Stale Shows' with Plex

truncsphere avatar Jul 22 '24 16:07 truncsphere

Unfortunately, the above log seems fine. It successfully unmonitored the show and removed all episodes. At least, the API calls to Sonarr were successful from Maintainer's point of view.

Did you enable the 'DEBUG=true' flag in your environment variables? If not, maybe that'll give us some more info. If you did enable it, it looks like everything went alright.

Also, could you check the history of an episode of these shows in Sonarr to make sure it wasn't redownloaded?

I did push some minor changes today, one of which fixes a small issue where seasons would stay monitored while the show is unmonitored. But I don't think this has any functional impact, since Sonarr wouldn't download episodes of an unmonitored show anyway.

jorenn92 avatar Jul 23 '24 08:07 jorenn92

I did not have DEBUG enabled.

Sonarr does not re-download the shows (I would get a notification at several stages of the download/addition to Plex).

I've deleted the shows manually for now.

truncsphere avatar Jul 23 '24 14:07 truncsphere

Okay, hopefully you won't run into it again! But If you do, could you share a log file when the DEBUG flag has been set?

jorenn92 avatar Aug 09 '24 09:08 jorenn92

I'm seeing a similar problem, the files are deleted from disks and it is removed from Sonarr. However the problem is that the TV shows are still showing in Plex, though when I try to play a show the files are unavailable. When I rerun the rules in maintainerr I think it is picking up the unavailable TV shows from Plex. Still testing but this may help if anyone else hits this.

DataBitz avatar Aug 21 '24 10:08 DataBitz

Another quick update, I have " Empty trash automatically after every scan" in Plex Library settings disabled. Once I emptied the trash in Plex manually it stopped coming back.

DataBitz avatar Aug 21 '24 10:08 DataBitz

Another quick update, I have " Empty trash automatically after every scan" in Plex Library settings disabled. Once I emptied the trash in Plex manually it stopped coming back.

Good catch! I can confirm your theory: If the item is still showing in Plex, Maintainerr assumes it's still available, which is why it keeps coming back.

jorenn92 avatar Aug 26 '24 07:08 jorenn92

What's the solution in the scenario, could maintainerr be set-up to take into account if the content is available or not?

DataBitz avatar Aug 26 '24 08:08 DataBitz

What's the solution in the scenario, could maintainerr be set-up to take into account if the content is available or not?

I could explore a way for Maintainerr to check if any files are associated with the Plex item, assuming Plex updates its file path to be empty. However, I don't have the time to implement this right now. For the foreseeable future, Plex servers should be configured to always reflect the actual state.

jorenn92 avatar Aug 26 '24 09:08 jorenn92

Ok The reason automatic garbage collection is disabled, is that if there is a problem with the media storage, it stops Plex doing a cleanup automatically and removing the history etc.

DataBitz avatar Aug 26 '24 10:08 DataBitz

I have a similar problem. Mostly with movies. When the timer in maintainerr reaches 0, maintainerr logs shows this:

Screenshot_20240904_174720_Firefox.jpg

When looking at Radarr, there are no API calls to remove the files and delete the movie from Radarr.

It seems like maintainerr is just skipping the whole Radarr part but removes the movie from itself, then at the next scan, he re-adds the movie again. Occasionally the logs from Maintainerr shows removed come fly with me (like on 8-8-2024 in above screenshot), but does not show Successfully handled come fly with me.

This has been happening for a long time now in multiple maintainerr versions.

When looking at the XML from Plex for this movie, it does have all the necessary IDs:

<Guid id="imdb://tt29081098"/>
<Guid id="tmdb://1165403"/>
<Guid id="tvdb://349372"/>

appiekap653 avatar Sep 12 '24 07:09 appiekap653

I

I have a similar problem. Mostly with movies. When the timer in maintainerr reaches 0, maintainerr logs shows this:

Screenshot_20240904_174720_Firefox.jpg

When looking at Radarr, there are no API calls to remove the files and delete the movie from Radarr.

It seems like maintainerr is just skipping the whole Radarr part but removes the movie from itself, then at the next scan, he re-adds the movie again. Occasionally the logs from Maintainerr shows removed come fly with me (like on 8-8-2024 in above screenshot), but does not show Successfully handled come fly with me.

This has been happening for a long time now in multiple maintainerr versions.

When looking at the XML from Plex for this movie, it does have all the necessary IDs:

<Guid id="imdb://tt29081098"/>
<Guid id="tmdb://1165403"/>
<Guid id="tvdb://349372"/>

Do you have logs of these executions as well? This looks quite bizarre. It seems that something else is removing the item from the collection between runs, which causes Maintainer to re-add it. (However, when manually removed from the Plex collection, Maintainerr should create an exclusion)

Regarding the 'Removed ...' log line without a corresponding 'Successfully handled ...' message: This can occur if the item no longer matches the rule criteria before the removal takes place. In such cases, the item is removed again, and you'll only see the 'removed' message.

jorenn92 avatar Sep 13 '24 07:09 jorenn92

I'm running into this issue as well. I have a library of YouTube videos that is exhibiting the same behavior. Items will get removed and then re-added to the collection. They are not getting deleted. Here is an example. You can see this is getting removed and then re-added daily:

Screenshot 2024-10-17 at 11 48 05 AM

macstainless avatar Oct 17 '24 15:10 macstainless

I'm running into this issue as well. I have a library of YouTube videos that is exhibiting the same behavior. Items will get removed and then re-added to the collection. They are not getting deleted. Here is an example. You can see this is getting removed and then re-added daily:

Screenshot 2024-10-17 at 11 48 05 AM

Are you seeing anything in your Sonarr logs? Are there any entries about deleting or failure to delete? This has happened to a few people in the past, and the answer was usually a change to the hostname they were using in the Sonarr/Radarr settings of Maintainerr. I even had this problem when I started because I was using the docker container hostname. When I switched to the IP address it started to work. Even though my connection test were coming back as successful.

ydkmlt84 avatar Oct 18 '24 01:10 ydkmlt84

I'm running into this issue as well. I have a library of YouTube videos that is exhibiting the same behavior. Items will get removed and then re-added to the collection. They are not getting deleted. Here is an example. You can see this is getting removed and then re-added daily: Screenshot 2024-10-17 at 11 48 05 AM

Are you seeing anything in your Sonarr logs? Are there any entries about deleting or failure to delete? This has happened to a few people in the past, and the answer was usually a change to the hostname they were using in the Sonarr/Radarr settings of Maintainerr. I even had this problem when I started because I was using the docker container hostname. When I switched to the IP address it started to work. Even though my connection test were coming back as successful.

In my situation, my YouTube Plex library is not associated with Sonarr, so there's no logs. Those items are imported via a script into my Plex library. My understanding is Maintainarr isn't dependent on the item being located in Sonarr / Radarr and will delete from Plex as long as it meets the criteria in the library.

macstainless avatar Oct 18 '24 15:10 macstainless

This issue has been marked stale because it has been 30 days with no activity.

github-actions[bot] avatar Nov 18 '24 04:11 github-actions[bot]

In my situation, my YouTube Plex library is not associated with Sonarr, so there's no logs. Those items are imported via a script into my Plex library. My understanding is Maintainarr isn't dependent on the item being located in Sonarr / Radarr and will delete from Plex as long as it meets the criteria in the library.

Hi @macstainless, that should be the case yes. I presume you have Allow media deletion enabled in Plex?

benscobie avatar Nov 19 '24 14:11 benscobie

In my situation, my YouTube Plex library is not associated with Sonarr, so there's no logs. Those items are imported via a script into my Plex library. My understanding is Maintainarr isn't dependent on the item being located in Sonarr / Radarr and will delete from Plex as long as it meets the criteria in the library.

Hi @macstainless, that should be the case yes. I presume you have Allow media deletion enabled in Plex?

Yes I do have that enabled on Plex.

macstainless avatar Nov 27 '24 14:11 macstainless

I have the same issue, media is not being deleted for the past months is there a solution or has it been fixed?

lediszep avatar Dec 11 '24 16:12 lediszep

I have the same issue, media is not being deleted for the past months is there a solution or has it been fixed?

I would like to see what we can get figured out on Discord. Mind coming over there and we can take a look?

ydkmlt84 avatar Dec 12 '24 14:12 ydkmlt84

This issue has been marked stale because it has been 30 days with no activity.

github-actions[bot] avatar Jan 12 '25 04:01 github-actions[bot]