Sonarr version (exact version): 3.0.7.1477
Mono version (if Sonarr is not running on Windows): 5.20.1.34
OS: Ubuntu
Debug logs: enabled
Description of issue: I have set up Prowlarr and Sonarr. Searching works fine but when I try to download Sonarr shows a red cloud icon and the tooltip says “invalid torrent file specified”.
The logs have this to say:
—8<—
Mar 17 01:04:40 normandi docker[775709]: [Warn] ProcessDownloadDecisions: Couldn’t add report to download queue. Some.Series.S00E00.video
Mar 17 01:04:40 normandi docker[775709]: [v3.0.7.1477] MonoTorrent.TorrentException: Invalid torrent file specified —> MonoTorrent.BEncoding.BEncodingException: Invalid data found. Aborting
Mar 17 01:04:40 normandi docker[775709]: at MonoTorrent.BEncoding.BEncodeDecoder.DecodeTorrent (MonoTorrent.BEncoding.RawReader reader) [0x0001a] in <4a57d41ab7c745b0971575485f9e1359>:0
Mar 17 01:04:40 normandi docker[775709]: at MonoTorrent.BEncoding.BEncodedDictionary.DecodeTorrent (MonoTorrent.BEncoding.RawReader reader) [0x00000] in <4a57d41ab7c745b0971575485f9e1359>:0
Mar 17 01:04:40 normandi docker[775709]: at MonoTorrent.BEncoding.BEncodedDictionary.DecodeTorrent (System.IO.Stream s) [0x00006] in <4a57d41ab7c745b0971575485f9e1359>:0
Mar 17 01:04:40 normandi docker[775709]: at MonoTorrent.Torrent.Load (System.IO.Stream stream, System.String path) [0x0000c] in <4a57d41ab7c745b0971575485f9e1359>:0
Mar 17 01:04:40 normandi docker[775709]: — End of inner exception stack trace —
Mar 17 01:04:40 normandi docker[775709]: at MonoTorrent.Torrent.Load (System.IO.Stream stream, System.String path) [0x00033] in <4a57d41ab7c745b0971575485f9e1359>:0
Mar 17 01:04:40 normandi docker[775709]: at MonoTorrent.Torrent.Load (System.Byte[] data) [0x0000d] in <4a57d41ab7c745b0971575485f9e1359>:0
Mar 17 01:04:40 normandi docker[775709]: at NzbDrone.Core.MediaFiles.TorrentInfo.TorrentFileInfoReader.GetHashFromTorrentFile (System.Byte[] fileContents) [0x00000] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\MediaFiles\TorrentInfo\TorrentFileInfoReader.cs:14
Mar 17 01:04:40 normandi docker[775709]: at NzbDrone.Core.Download.TorrentClientBase1[TSettings].DownloadFromWebUrl (NzbDrone.Core.Parser.Model.RemoteEpisode remoteEpisode, System.String torrentUrl) [0x00223] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Download\TorrentClientBase.cs:189 Mar 17 01:04:40 normandi docker[775709]: at NzbDrone.Core.Download.TorrentClientBase
1[TSettings].DownloadFromWebUrl (NzbDrone.Core.Parser.Model.RemoteEpisode remoteEpisode, System.String torrentUrl) [0x000cc] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Download\TorrentClientBase.cs:152
Mar 17 01:04:40 normandi docker[775709]: at NzbDrone.Core.Download.TorrentClientBase1[TSettings].Download (NzbDrone.Core.Parser.Model.RemoteEpisode remoteEpisode) [0x00148] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Download\TorrentClientBase.cs:117 Mar 17 01:04:40 normandi docker[775709]: at NzbDrone.Core.Download.DownloadService.DownloadReport (NzbDrone.Core.Parser.Model.RemoteEpisode remoteEpisode) [0x0019f] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Download\DownloadService.cs:75 Mar 17 01:04:40 normandi docker[775709]: at NzbDrone.Core.Download.ProcessDownloadDecisions.ProcessDecisions (System.Collections.Generic.List
1[T] decisions) [0x00104] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Download\ProcessDownloadDecisions.cs:77
—8<—
I think the problem is that Sonarr interacts badly with the way Prowlar shares magnet download URLs - looking at the HTTP logs for the Prowlarr reverse proxy, I see things like this (after clicking the download button in Sonarr):
—8<----
172.17.0.6 - - [17/Mar/2022:01:04:32 +0200] “GET /51/download?apikey=XXXX&link=VERYLONGTEXT&file=Some.Series.S00E00.video HTTP/1.1” 301 4104 “-” “Sonarr/3.0.7.1477 (ubuntu 18.04)”
172.17.0.6 - - [17/Mar/2022:01:04:32 +0200] “GET /?apikey=XXXX&link=VERYLONGTEXT&file=Some.Series.S00E00.video HTTP/1.1” 200 6198 “-” “Sonarr/3.0.7.1477 (ubuntu 18.04)”
—8<----
The first request is what Prowlarr expects - its in the Prowlarr search results RSS (I did a network dump to verify), and when Sonarr calls that, it gets a 301 permanent redirect. Here’s me manually running the query:
—8<—
$ curl -D- ‘https://my.server/51/download?apikey=XXXX&link=VERYLONGTEXT&file=Some.Series.S00E00.video’
HTTP/1.1 301 Moved Permanently
Date: Wed, 16 Mar 2022 23:01:24 GMT
Server: Kestrel
Content-Length: 0
Cache-Control: max-age=31536000, public
Last-Modified: Mon, 31 Jan 2022 18:22:22 GMT
Location: magnet:?xt=urn:…
X-ApplicationVersion: 0.2.0.1448
—8<—
So it looks like after Sonarr gets the 301 response, instead of using the magnet URL in the Location header, it re-issues the request with a path of /
(instead of the Prowlarr provided indexer download path), which Prowlarr obviously responds with something that is not a torrent file.
I’m not sure if Prowlarr is set up properly - I don’t think its supposed to send a redirect to a magnet link, but I can’t find where to configure it not to do so: all the indexers have a setting for “Redirect” that seems appropriate - it says that when disabled Prowlarr will proxy the content from the indexer instead of sending a redirect to the indexer - but this checkbox is unchecked and actually disabled in all my indexer, it cannot be turned on.
Though I’m pretty sure Sonarr is at fault here - no way the correct handling of a 301 to a magnet URL is to call the root path on the HTTP server.
I’m pretty sure its a recent change in Prowlarr (I have an auto update using linuxserver’s docker image), as right now Radarr can’t download from Prowlarr with the exact same behavior.