{"record":{"id":"308c025ece4fcdc0","repo":"Sonarr/Sonarr","slug":"unable-to-send-notification-service-unavailable","errorCode":null,"errorMessage":"Unable to send notification. Service Unavailable","messagePattern":"Unable to send notification\\. Service Unavailable","errorType":"exception","errorClass":"NotifiarrException","httpStatus":503,"severity":"error","filePath":"src/NzbDrone.Core/Notifications/Notifiarr/NotifiarrProxy.cs","lineNumber":64,"sourceCode":"            }\n            catch (HttpException ex)\n            {\n                var responseCode = ex.Response.StatusCode;\n                switch ((int)responseCode)\n                {\n                    case 401:\n                        _logger.Error(\"HTTP 401 - API key is invalid\");\n                        throw new NotifiarrException(\"API key is invalid\");\n                    case 400:\n                        // 400 responses shouldn't be treated as an actual error because it's a misconfiguration\n                        // between Sonarr and Notifiarr for a specific event, but shouldn't stop all events.\n                        _logger.Error(\"HTTP 400 - Unable to send notification. Ensure Sonarr Integration is enabled & assigned a channel on Notifiarr\");\n                        break;\n                    case 502:\n                    case 503:\n                    case 504:\n                        _logger.Error(\"Unable to send notification. Service Unavailable\");\n                        throw new NotifiarrException(\"Unable to send notification. Service Unavailable\", ex);\n                    case 520:\n                    case 521:\n                    case 522:\n                    case 523:\n                    case 524:\n                        throw new NotifiarrException(\"Cloudflare Related HTTP Error - Unable to send notification\", ex);\n                    default:\n                        _logger.Error(ex, \"Unknown HTTP Error - Unable to send notification\");\n                        throw new NotifiarrException(\"Unknown HTTP Error - Unable to send notification\", ex);\n                }\n            }\n        }\n    }\n}\n","sourceCodeStart":46,"sourceCodeEnd":79,"githubUrl":"https://github.com/Sonarr/Sonarr/blob/da2284d7eaab22ed9b2ca698af690148d691e967/src/NzbDrone.Core/Notifications/Notifiarr/NotifiarrProxy.cs#L46-L79","documentation":"NotifiarrException(\"Unable to send notification. Service Unavailable\") is thrown when Notifiarr responds with HTTP 502, 503, or 504. These are gateway/availability errors indicating Notifiarr's backend or its upstream is temporarily down. The original HttpException is passed as the inner exception.","triggerScenarios":"ProcessNotification POSTs to Notifiarr and receives 502 Bad Gateway, 503 Service Unavailable, or 504 Gateway Timeout. The switch falls into the combined case 502/503/504 branch, logs the error, and throws.","commonSituations":"Notifiarr is undergoing maintenance or an outage. Notifiarr's upstream provider is degraded. The request payload is large and the gateway timed out (504). Transient network congestion between Sonarr's host and Notifiarr.","solutions":["Retry the notification after a few minutes; 502/503/504 are typically transient.","Check the Notifiarr status page or Discord for ongoing incidents.","If 504 persists, verify network throughput and that no firewall is dropping long-lived connections.","Sonarr will retry on subsequent events automatically; no permanent config change is needed for a transient outage."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Cannot pre-validate a server outage; validate reachable URL only\nif (!Uri.TryCreate(\"https://notifiarr.com\", UriKind.Absolute, out _))\n{\n    /* network config issue */\n}","typeGuard":"public static bool IsNotifiarrUnavailable(Exception ex) => ex is Notifiarr.NotifiarrException && ex.Message.Contains(\"Service Unavailable\");","tryCatchPattern":"// Retry transient 502/503/504 with backoff\nint attempts = 0;\nwhile (true)\n{\n    try { _notifiarrProxy.SendNotification(payload, settings); break; }\n    catch (NotifiarrException ex) when (ex.Message.Contains(\"Service Unavailable\") && attempts++ < 3)\n    {\n        await Task.Delay(TimeSpan.FromSeconds(5 * attempts));\n    }\n}","preventionTips":["Implement exponential backoff for 502/503/504.","Do not treat service-unavailable as a config error; alert on repeated failures.","Subscribe to Notifiarr status notifications."],"tags":["notifiarr","notifications","network","service-unavailable","csharp"],"backgroundTag":null,"analyzedSha":"da2284d7eaab22ed9b2ca698af690148d691e967","analyzedAt":"2026-08-13T15:53:02.562Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}