Sonarr/Sonarr · error · DownloadClientException

Unable to connect to Deluge, please check your settings

Error message

Unable to connect to Deluge, please check your settings

What it means

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).

Source

Thrown at src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs:283

            try
            {
                response = _httpClient.Execute(request);

                return Json.Deserialize<JsonRpcResponse<TResult>>(response.Content);
            }
            catch (HttpException ex)
            {
                if (ex.Response.StatusCode == HttpStatusCode.RequestTimeout)
                {
                    _logger.Debug("Deluge timeout during request, daemon connection may have been broken. Attempting to reconnect.");
                    return new JsonRpcResponse<TResult>()
                    {
                        Error = JToken.Parse("{ Code = 2 }")
                    };
                }
                else
                {
                    throw new DownloadClientException("Unable to connect to Deluge, please check your settings", ex);
                }
            }
            catch (WebException ex)
            {
                if (ex.Status == WebExceptionStatus.TrustFailure)
                {
                    throw new DownloadClientUnavailableException("Unable to connect to Deluge, certificate validation failed.", ex);
                }

                throw new DownloadClientUnavailableException("Unable to connect to Deluge, please check your settings", ex);
            }
        }

        private void VerifyResponse<TResult>(JsonRpcResponse<TResult> response)
        {
            if (response.Error != null)
            {
                var error = response.Error.ToObject<DelugeError>();

View on GitHub (pinned to da2284d7ea)

Solutions

  1. Check Sonarr's Deluge settings: Host, Port, UrlBase (often 'deluge'), and UseSsl match how the web UI is actually served.
  2. If behind a reverse proxy, hit the Deluge URL directly from the Sonarr host with curl to see the real status code.
  3. Confirm the Deluge web UI is reachable and not returning an error page.
  4. Restart the Deluge web plugin / daemon if it is serving 5xx errors.
Defensive patterns

Strategy: try-catch

Validate before calling

// Cheap reachability check before issuing JSON-RPC.
public bool IsReachable(DelugeSettings s)
{
    var url = HttpRequestBuilder.BuildBaseUrl(s.UseSsl, s.Host, s.Port, s.UrlBase) + "/json";
    try { _httpClient.Execute(new HttpRequest(url) { RequestTimeout = TimeSpan.FromSeconds(5) }); return true; }
    catch (HttpException) { return false; }
}

Try / catch

try { _proxy.GetItems(); }
catch (DownloadClientException ex) when (ex.InnerException is HttpException)
{
    _logger.Error(ex, "Deluge returned an HTTP error; check UrlBase/reverse proxy.");
}

Prevention

When it happens

Trigger: _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.

Common situations: 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.

Related errors


AI-assisted analysis of Sonarr/Sonarr@da2284d7ea (2026-08-13). Data as JSON: /api/errors/6ca6e54b047c46f1. Report an issue: GitHub.