{"record":{"id":"d8e69f0fe8d0c7ac","repo":"Radarr/Radarr","slug":"indexer-api-call-returned-an-unexpected-statuscode","errorCode":null,"errorMessage":"Indexer API call returned an unexpected StatusCode [{0}]","messagePattern":"Indexer API call returned an unexpected StatusCode \\[(.+?)\\]","errorType":"exception","errorClass":"IndexerException","httpStatus":null,"severity":"error","filePath":"src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoParser.cs","lineNumber":24,"sourceCode":"using NzbDrone.Core.Indexers.Exceptions;\nusing NzbDrone.Core.Parser.Model;\n\nnamespace NzbDrone.Core.Indexers.TorrentPotato\n{\n    public class TorrentPotatoParser : IParseIndexerResponse\n    {\n        private static readonly Regex RegexGuid = new Regex(@\"^magnet:\\?xt=urn:btih:([a-f0-9]+)\", RegexOptions.Compiled);\n\n        public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)\n        {\n            var results = new List<ReleaseInfo>();\n\n            switch (indexerResponse.HttpResponse.StatusCode)\n            {\n                default:\n                    if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)\n                    {\n                        throw new IndexerException(indexerResponse, \"Indexer API call returned an unexpected StatusCode [{0}]\", indexerResponse.HttpResponse.StatusCode);\n                    }\n\n                    break;\n            }\n\n            var jsonResponse = new HttpResponse<TorrentPotatoResponse>(indexerResponse.HttpResponse);\n\n            foreach (var torrent in jsonResponse.Resource.results)\n            {\n                var torrentInfo = new TorrentInfo();\n\n                torrentInfo.Guid = GetGuid(torrent);\n                torrentInfo.Title = torrent.release_name;\n                torrentInfo.Size = (long)torrent.size * 1000 * 1000;\n                torrentInfo.DownloadUrl = torrent.download_url;\n                torrentInfo.InfoUrl = torrent.details_url;\n                torrentInfo.PublishDate = torrent.publish_date.ToUniversalTime();\n                torrentInfo.Seeders = torrent.seeders;","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/Radarr/Radarr/blob/ca451608dc60c6cec754aba8d96bfa30e9468ed5/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoParser.cs#L6-L42","documentation":"TorrentPotatoParser.ParseResponse throws an IndexerException when the TorrentPotato indexer's HTTP status is anything other than 200 OK. The switch falls into the default branch and, finding the status is not OK, aborts before attempting to deserialize the JSON into a TorrentPotatoResponse.","triggerScenarios":"A TorrentPotato-compatible indexer (e.g. Jackett's TorrentPotato endpoint) returns 401/403 for a bad passkey, 404 if the path is wrong, 429 under load, or any 5xx during Jackett downtime.","commonSituations":"The Jackett URL or TorrentPotato path is misconfigured; the Jackett API key/passkey is wrong or expired; Jackett is restarting or down; a reverse proxy in front of Jackett returns a non-200 (e.g. 502 from a stale upstream).","solutions":["Read IndexerException.Response.HttpResponse.StatusCode to identify the specific non-200 status.","401/403/404: correct the Jackett BaseUrl and TorrentPotato path and verify the API key in indexer settings.","5xx/502: confirm Jackett is running and reachable, then retry.","429: lower the sync interval / raise the indexer rate-limit cooldown.","Open the Jackett URL in a browser to confirm it serves the TorrentPotato endpoint for your indexer."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate Jackett/TorrentPotato reachability before parsing\nif (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)\n    logger.Warn(\"TorrentPotato endpoint returned {0}; check Jackett URL/key.\",\n                indexerResponse.HttpResponse.StatusCode);","typeGuard":"null","tryCatchPattern":"try { var releases = parser.ParseResponse(indexerResponse); }\ncatch (IndexerException ex)\n{\n    var code = ex.Response.HttpResponse.StatusCode;\n    if (code == HttpStatusCode.Unauthorized || code == HttpStatusCode.Forbidden) logger.Error(\"Bad TorrentPotato key/URL\");\n    throw;\n}","preventionTips":["Keep Jackett URL and TorrentPotato path correct","Keep the Jackett API key current","Confirm Jackett is running before syncing"],"tags":["torrentpotato","indexer","http-status","jackett","csharp"],"backgroundTag":null,"analyzedSha":"ca451608dc60c6cec754aba8d96bfa30e9468ed5","analyzedAt":"2026-08-13T17:21:54.115Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}