-
-
Notifications
You must be signed in to change notification settings - Fork 79
Episodes with undefined index (e.g. daily shows) are silently not deleted/unmonitored in Sonarr #2491
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug
When a rule matches episodes whose Plex metadata has no index (episode number) — common with daily shows like Jeopardy! — the episodes are removed from the Maintainerr collection but never actually deleted or unmonitored in Sonarr.
Steps to Reproduce
- Create a rule targeting episodes of a daily show (e.g. Jeopardy!) using
Sonarr.filePathandTautulli.sw_amountOfViews - Wait for the collection to be processed
- Observe that episodes are removed from the Maintainerr collection but remain in Sonarr (still monitored, files not deleted)
Expected Behavior
Matched episodes should be deleted/unmonitored in Sonarr regardless of whether Plex provides a numeric episode index.
Actual Behavior
- Maintainerr logs show:
Removed season 2026 episode undefined from show 'Jeopardy!' - The episode is removed from the Maintainerr collection but no Sonarr action is taken
- Compare with SNL which works:
Removed season 51 episode 13 from show 'Saturday Night Live'
Root Cause
SonarrActionHandler.handleAction()fetches Plex metadata viamediaServer.getMetadata(), which returnsundefinedfor theindexfield on certain daily show episodes- This
undefinedis passed toSonarrApi.UnmonitorDeleteEpisodes()as[undefined] getEpisodes()insonarr.helper.tsfilters withepisodeNumbers.includes(el.episodeNumber)— no episode matchesundefined, so an empty array is returned- The
forloop does nothing, and the error is silently swallowed - Meanwhile, the media has already been removed from the Maintainerr collection (there is a TODO in
collection-handler.tsacknowledging this ordering issue)
Relevant Code
sonarr.helper.ts—getEpisodes()(line ~56) andUnmonitorDeleteEpisodes()(line ~156)sonarr-action-handler.ts—mediaData?.indexpassed at line ~105collection-handler.ts— collection removal before action (line ~49, has existing TODO)
Possible Fix
When the episode index is undefined, fall back to an alternative identification method — e.g. matching by Sonarr episode file path, air date, or episode file ID rather than episode number.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working