{"record":{"id":"7061b5d7c6714a13","repo":"Radarr/Radarr","slug":"failed-to-add-torrent-task-to-download-station","errorCode":null,"errorMessage":"Failed to add torrent task to Download Station","messagePattern":"Failed to add torrent task to Download Station","errorType":"exception","errorClass":"DownloadClientException","httpStatus":null,"severity":"error","filePath":"src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs","lineNumber":203,"sourceCode":"        protected override string AddFromTorrentFile(RemoteMovie remoteMovie, string hash, string filename, byte[] fileContent)\n        {\n            var hashedSerialNumber = _serialNumberProvider.GetSerialNumber(Settings);\n\n            DsTaskProxy.AddTaskFromData(fileContent, filename, GetDownloadDirectory(), Settings);\n\n            var items = GetTasks().Where(t => t.Additional.Detail[\"uri\"] == Path.GetFileNameWithoutExtension(filename));\n\n            var item = items.SingleOrDefault();\n\n            if (item != null)\n            {\n                _logger.Debug(\"{0} added correctly\", remoteMovie);\n                return CreateDownloadId(item.Id, hashedSerialNumber);\n            }\n\n            _logger.Debug(\"No such task {0} in Download Station\", filename);\n\n            throw new DownloadClientException(\"Failed to add torrent task to Download Station\");\n        }\n\n        protected override void Test(List<ValidationFailure> failures)\n        {\n            failures.AddIfNotNull(TestConnection());\n            if (failures.HasErrors())\n            {\n                return;\n            }\n\n            failures.AddIfNotNull(TestOutputPath());\n            failures.AddIfNotNull(TestGetTorrents());\n        }\n\n        protected bool IsFinished(DownloadStationTask torrent)\n        {\n            return torrent.Status == DownloadStationTaskStatus.Finished;\n        }","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/Radarr/Radarr/blob/ca451608dc60c6cec754aba8d96bfa30e9468ed5/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs#L185-L221","documentation":"Thrown by TorrentDownloadStation.AddFromTorrentFile after DsTaskProxy.AddTaskFromData succeeded but the follow-up GetTasks() query finds no task whose Additional.Detail['uri'] equals Path.GetFileNameWithoutExtension(filename). The upload returned no error, yet the task is not discoverable, so Radarr cannot produce a download id.","triggerScenarios":"DownloadStation silently rejected/deduplicated the .torrent (duplicate infohash); DS lists the task under a different uri key (the uploaded filename vs DS's internal name); eventual-consistency delay before the task appears in the list; the torrent file was malformed and DS dropped it without an error code.","commonSituations":"Re-adding a torrent already present in DS; DS renaming the source uri on import; slow DS task registration; binary torrent file with encoding issues during upload.","solutions":["Check DownloadStation for an existing task with the same hash and remove it, or rely on the existing entry.","Retry the add after a short delay to rule out a listing race.","Confirm the .torrent file is valid by adding it manually in DS.","Inspect DS logs for silent rejection (duplicate, invalid bencode, unsupported format)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    var id = AddFromTorrentFile(remoteMovie, hash, filename, fileContent);\n}\ncatch (DownloadClientException ex) when (ex.Message == \"Failed to add torrent task to Download Station\")\n{\n    _logger.Warn(ex, \"Torrent file not found in DownloadStation after add: {0}\", filename);\n    ScheduleRetry();\n}","preventionTips":["Remove existing duplicate torrents in DS before re-adding by file.","Validate the .torrent by adding it manually in DS first.","Account for DS renaming the source uri on import.","Allow a short delay between add and lookup."],"tags":["downloadstation","synology","torrent-file","add-task","race-condition","download-client"],"backgroundTag":null,"analyzedSha":"ca451608dc60c6cec754aba8d96bfa30e9468ed5","analyzedAt":"2026-08-13T17:21:54.115Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}