BUG: Blocklist & Search fails with 400 Bad Request on season packs / multi-episode releases #44
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem:
The "Blocklist & Search" button on download cards fails with a "400 Bad Request (Missing required fields)" when clicked on any television release in Sonarr that represents a full season package or a multi-episode release.
Root Cause:
server/services/DownloadMatcher.js, when a download is matched with a Sonarr queue record,arrContentIdis populated withsonarrMatch.episodeId || null.episodeIdfield is missing from the queue record payload (since the release is associated with multiple episodes). Instead, Sonarr provides anepisodeIdsarray. As a result,arrContentIdis normalized tonull.POST /api/dashboard/blocklist-searchendpoint. The request body includesarrContentId: null.server/routes/dashboard.jsstrictly requires all fields includingarrContentIdto be truthy:arrContentIdisnull, this check fails and returns400 Missing required fields, completely blocking the blocklist operation (even though queue removal itself does not require an episode ID).dashboard.jsonly handles single episode searches via{ name: 'EpisodeSearch', episodeIds: [arrContentId] }and has no logic to handleepisodeIdsarrays or fallback searches (such asSeriesSearchorSeasonSearch).Proposed Fix:
arrContentIdto be optional or null forsonarrqueue records to ensure the deletion and blocklist steps can still execute.episodeIdis missing butepisodeIdsarray is available on the matched record, pass the array of IDs to the frontend/backend.dashboard.jsre-search block to supportEpisodeSearchwith multiple IDs, or fall back to triggering aSeriesSearchcommand using theseriesIdif no specific episode IDs are resolved.I have investigated the blocklist & search failure reported in this issue and created a technical remediation plan:
Root Cause
For television grabs representing a full-season pack or multi-episode package in Sonarr, the
episodeIdproperty is absent (instead, it has anepisodeIdsarray). This maps to anullvalue forarrContentIdon the client download card. The/api/dashboard/blocklist-searchroute strictly requires all fields includingarrContentIdto be truthy, returning400 Bad Request: Missing required fieldsand completely blocking the queue blocklist/removal action.Remediation Plan
arrContentIds(sonarrMatch.episodeIds) andarrSeriesId(sonarrMatch.seriesId) fromDownloadMatcher.jsto the normalized download card object.arrContentIdfrom the mandatory request parameters check inserver/routes/dashboard.js.arrContentIdis provided, triggerEpisodeSearchfor that single ID.arrContentIdsarray is provided, triggerEpisodeSearchwith that list of IDs.arrSeriesIdis provided, fall back to triggering a series-wideSeriesSearch.Upon approval, I will execute this plan, merge to
main, close this ticket referencing the resolving commit, and cut a new point release (v1.7.11).Resolved in commit
5488969387.