{"record":{"id":"61a6778e273b1b2d","repo":"Sonarr/Sonarr","slug":"download-client-with-name-0-could-not-be-found-61a677","errorCode":null,"errorMessage":"Download client with name '{0}' could not be found","messagePattern":"Download client with name '(.+?)' could not be found","errorType":"exception","errorClass":"ResolveDownloadClientException","httpStatus":null,"severity":"error","filePath":"src/NzbDrone.Core/Download/DownloadClientProvider.cs","lineNumber":137,"sourceCode":"        public void ReportSuccessfulDownloadClient(DownloadProtocol downloadProtocol, int downloadClientId)\n        {\n            _lastUsedDownloadClient.Set(downloadProtocol.ToString(), downloadClientId);\n        }\n\n        public DownloadClientDefinition ResolveDownloadClient(int? downloadClientId, string downloadClientName)\n        {\n            var all = _downloadClientFactory.All();\n            var clientByName = downloadClientName.IsNullOrWhiteSpace() ? null : all.FirstOrDefault(c => c.Name.EqualsIgnoreCase(downloadClientName));\n            var clientById = downloadClientId.HasValue ? all.FirstOrDefault(c => c.Id == downloadClientId.Value) : null;\n\n            if (downloadClientId.HasValue && clientById == null)\n            {\n                throw new ResolveDownloadClientException(\"Download client with ID '{0}' could not be found\", downloadClientId.Value);\n            }\n\n            if (downloadClientName.IsNotNullOrWhiteSpace() && clientByName == null)\n            {\n                throw new ResolveDownloadClientException(\"Download client with name '{0}' could not be found\", downloadClientName);\n            }\n\n            if (clientByName == null && clientById == null)\n            {\n                return null;\n            }\n\n            if (clientByName != null && clientById != null && clientByName.Id != clientById.Id)\n            {\n                throw new ResolveDownloadClientException(\"Download client with name '{0}' does not match download client with ID '{1}'\", downloadClientName, downloadClientId.Value);\n            }\n\n            var client = clientById ?? clientByName;\n\n            if (!client.Enable)\n            {\n                throw new ResolveDownloadClientException(\"Download client '{0}' ({1}) is not enabled\", client.Name, downloadClientId);\n            }","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/Sonarr/Sonarr/blob/da2284d7eaab22ed9b2ca698af690148d691e967/src/NzbDrone.Core/Download/DownloadClientProvider.cs#L119-L155","documentation":"Thrown by DownloadClientProvider.ResolveDownloadClient when downloadClientName is non-blank but no definition's Name matches it case-insensitively. ResolveDownloadClientException (HTTP 400). Like error 182 this Provider method has no current production callers; the Factory method is the live path.","triggerScenarios":"Calling ResolveDownloadClient(null, name) (or with a non-matching id) where name does not EqualIgnoreCase any DownloadClientDefinition.Name.","commonSituations":"The client was renamed or deleted; the name has a typo, extra whitespace, or different casing/spacing than the configured name; an integration stored a display name rather than the configured name.","solutions":["Correct the name to exactly match a configured client's Name (case-insensitive).","Omit the name and supply the id instead.","Recreate the client with the expected name."],"exampleFix":"// before:\n//   ResolveDownloadClient(null, \"SABnzbd \");  // trailing space, no match\n\n// after:\n//   ResolveDownloadClient(null, \"Sabnzbd\");  // exact configured name","handlingStrategy":"validation","validationCode":"if (!string.IsNullOrWhiteSpace(downloadClientName) &&\n    !_downloadClientFactory.All().Any(c => c.Name.EqualsIgnoreCase(downloadClientName)))\n{\n    // name does not match any client: correct or drop it\n    downloadClientName = null;\n}","typeGuard":null,"tryCatchPattern":"try { var client = provider.ResolveDownloadClient(downloadClientId, downloadClientName); }\ncatch (ResolveDownloadClientException ex) when (ex.Message.Contains(\"could not be found\"))\n{\n    // handle: client name not found\n}","preventionTips":["Store the exact configured Name, not a display label.","Trim whitespace from names before sending.","After a rename, update stored names in integrations."],"tags":["download-client","configuration","not-found"],"backgroundTag":null,"analyzedSha":"da2284d7eaab22ed9b2ca698af690148d691e967","analyzedAt":"2026-08-13T15:53:02.562Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}