{"record":{"id":"6ca6e54b047c46f1","repo":"Sonarr/Sonarr","slug":"unable-to-connect-to-deluge-please-check-your-set","errorCode":null,"errorMessage":"Unable to connect to Deluge, please check your settings","messagePattern":"Unable to connect to Deluge, please check your settings","errorType":"exception","errorClass":"DownloadClientException","httpStatus":null,"severity":"error","filePath":"src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs","lineNumber":283,"sourceCode":"            try\n            {\n                response = _httpClient.Execute(request);\n\n                return Json.Deserialize<JsonRpcResponse<TResult>>(response.Content);\n            }\n            catch (HttpException ex)\n            {\n                if (ex.Response.StatusCode == HttpStatusCode.RequestTimeout)\n                {\n                    _logger.Debug(\"Deluge timeout during request, daemon connection may have been broken. Attempting to reconnect.\");\n                    return new JsonRpcResponse<TResult>()\n                    {\n                        Error = JToken.Parse(\"{ Code = 2 }\")\n                    };\n                }\n                else\n                {\n                    throw new DownloadClientException(\"Unable to connect to Deluge, please check your settings\", ex);\n                }\n            }\n            catch (WebException ex)\n            {\n                if (ex.Status == WebExceptionStatus.TrustFailure)\n                {\n                    throw new DownloadClientUnavailableException(\"Unable to connect to Deluge, certificate validation failed.\", ex);\n                }\n\n                throw new DownloadClientUnavailableException(\"Unable to connect to Deluge, please check your settings\", ex);\n            }\n        }\n\n        private void VerifyResponse<TResult>(JsonRpcResponse<TResult> response)\n        {\n            if (response.Error != null)\n            {\n                var error = response.Error.ToObject<DelugeError>();","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/Sonarr/Sonarr/blob/da2284d7eaab22ed9b2ca698af690148d691e967/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs#L265-L301","documentation":"Thrown by DelugeProxy.ExecuteRequest in the HttpException catch block when the HTTP status is NOT RequestTimeout. The inner HttpException is wrapped as DownloadClientException - a hard failure indicating the Deluge web endpoint responded with an HTTP error (4xx/5xx other than 408).","triggerScenarios":"_httpClient.Execute(request) throws HttpException and ex.Response.StatusCode != HttpStatusCode.RequestTimeout. Typical statuses: 401 Unauthorized, 403 Forbidden, 500/502/503 from the Deluge web server, or a reverse proxy returning an error page.","commonSituations":"Reverse proxy (nginx/apache) in front of Deluge returning 502/503; Deluge web UI behind a path prefix that Sonarr's UrlBase does not match; web server throttling; Deluge web plugin crashed but the port is held by another service.","solutions":["Check Sonarr's Deluge settings: Host, Port, UrlBase (often 'deluge'), and UseSsl match how the web UI is actually served.","If behind a reverse proxy, hit the Deluge URL directly from the Sonarr host with curl to see the real status code.","Confirm the Deluge web UI is reachable and not returning an error page.","Restart the Deluge web plugin / daemon if it is serving 5xx errors."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Cheap reachability check before issuing JSON-RPC.\npublic bool IsReachable(DelugeSettings s)\n{\n    var url = HttpRequestBuilder.BuildBaseUrl(s.UseSsl, s.Host, s.Port, s.UrlBase) + \"/json\";\n    try { _httpClient.Execute(new HttpRequest(url) { RequestTimeout = TimeSpan.FromSeconds(5) }); return true; }\n    catch (HttpException) { return false; }\n}","typeGuard":null,"tryCatchPattern":"try { _proxy.GetItems(); }\ncatch (DownloadClientException ex) when (ex.InnerException is HttpException)\n{\n    _logger.Error(ex, \"Deluge returned an HTTP error; check UrlBase/reverse proxy.\");\n}","preventionTips":["Match UrlBase to the reverse-proxy prefix exactly (e.g. 'deluge').","Hit the Deluge JSON endpoint directly from the Sonarr host during setup to isolate proxy layers.","Monitor for 5xx in Deluge's own logs and restart the web plugin when sustained."],"tags":["deluge","http","network","download-client","reverse-proxy"],"backgroundTag":null,"analyzedSha":"da2284d7eaab22ed9b2ca698af690148d691e967","analyzedAt":"2026-08-13T15:53:02.562Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}