{"record":{"id":"e492c4434957d1fc","repo":"Sonarr/Sonarr","slug":"rtorrent-returned-error-code-fault-faultcode-f","errorCode":null,"errorMessage":"rTorrent returned error code {fault.FaultCode}: {fault.FaultString}","messagePattern":"rTorrent returned error code (.+?): (.+?)","errorType":"exception","errorClass":"DownloadClientException","httpStatus":null,"severity":"error","filePath":"src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentProxy.cs","lineNumber":212,"sourceCode":"\n            if (!settings.Username.IsNullOrWhiteSpace())\n            {\n                requestBuilder.NetworkCredential = new NetworkCredential(settings.Username, settings.Password);\n            }\n\n            var request = requestBuilder.Call(methodName, args).Build();\n\n            var response = _httpClient.Execute(request);\n\n            var doc = XDocument.Parse(response.Content);\n\n            var faultElement = doc.XPathSelectElement(\"./methodResponse/fault\");\n\n            if (faultElement != null)\n            {\n                var fault = new RTorrentFault(faultElement);\n\n                throw new DownloadClientException($\"rTorrent returned error code {fault.FaultCode}: {fault.FaultString}\");\n            }\n\n            return doc;\n        }\n    }\n}\n","sourceCodeStart":194,"sourceCodeEnd":219,"githubUrl":"https://github.com/Sonarr/Sonarr/blob/da2284d7eaab22ed9b2ca698af690148d691e967/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentProxy.cs#L194-L219","documentation":"RTorrentProxy.ExecuteRequest throws DownloadClientException when the XML-RPC response document contains a <fault> element. It parses the fault into an RTorrentFault and surfaces both FaultCode and FaultString. An XML-RPC fault means rTorrent itself reported the method call failed (bad method name, wrong argument types/count, internal rTorrent error). This is the lowest-level rTorrent error in the proxy and is the root cause for many of the higher-level add/label/remove failures.","triggerScenarios":"Any ExecuteRequest where _httpClient.Execute returns content whose parsed XDocument has ./methodResponse/fault. Triggered by unknown XML-RPC method names, argument arity mismatches, type errors, or rTorrent internal failures (e.g. referencing a torrent hash that does not exist with d.* commands).","commonSituations":"rTorrent version mismatch (method renamed/removed, e.g. load.start vs load.normal across versions); wrong number of args to a d.* command; scgi payload type error; referring to a hash not present in the session; rTorrent plugin/config invoking undefined commands.","solutions":["Read the FaultCode and FaultString in the message — they identify the exact rTorrent-side rejection.","Match the XML-RPC method names/arity to the installed rTorrent version's documentation.","Ensure referenced hashes exist (use HasHashTorrent) before d.* commands.","Check rtorrent.rc / plugins for command definitions the code assumes exist."],"exampleFix":"// before: calling a method the rTorrent build doesn't expose -> fault\nvar response = ExecuteRequest(settings, \"load.start\", args.ToArray());  // fault: unknown method\n\n// after: branch on rTorrent capability / version, or use the supported command\nvar method = SupportsLoadStart(settings) ? \"load.start\" : \"load.normal\";\nvar response = ExecuteRequest(settings, method, args.ToArray());","handlingStrategy":"try-catch","validationCode":"// Probe a cheap method to confirm XML-RPC/scgi connectivity and version before heavy ops:\ntry { var v = _proxy.ExecuteRequest(settings, \"system.client_version\").GetStringResponse(); }\ncatch (DownloadClientException ex) { _logger.Warn(ex, \"rTorrent XML-RPC probe failed; check scgi/route.\"); }","typeGuard":"static bool IsXmlRpcFault(DownloadClientException ex) =>\n    ex.Message.Contains(\"rTorrent returned error code\", StringComparison.OrdinalIgnoreCase);","tryCatchPattern":"try { return _proxy.ExecuteRequest(settings, method, args); }\ncatch (DownloadClientException ex) when (IsXmlRpcFault(ex))\n{\n    _logger.Error(ex, \"rTorrent XML-RPC fault on '{0}'; check method name/arity/version.\", method);\n    throw;\n}","preventionTips":["Match XML-RPC method names/arity to the installed rTorrent version.","Confirm referenced hashes exist before d.* commands (HasHashTorrent).","Read FaultCode/FaultString precisely — they name the rTorrent-side rejection.","Validate rtorrent.rc defines any commands/plugins the code assumes."],"tags":["rtorrent","xmlrpc","fault","download-client"],"backgroundTag":null,"analyzedSha":"da2284d7eaab22ed9b2ca698af690148d691e967","analyzedAt":"2026-08-13T15:53:02.562Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}