{"record":{"id":"9596ee0831e6d09a","repo":"Sonarr/Sonarr","slug":"remotepath-already-configured","errorCode":null,"errorMessage":"RemotePath already configured.","messagePattern":"RemotePath already configured\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"warning","filePath":"src/NzbDrone.Core/RemotePathMappings/RemotePathMappingService.cs","lineNumber":124,"sourceCode":"\n            if (remotePath.IsEmpty)\n            {\n                throw new ArgumentException(\"Invalid RemotePath. RemotePath cannot be empty.\");\n            }\n\n            if (localPath.IsEmpty || !localPath.IsRooted)\n            {\n                throw new ArgumentException(\"Invalid LocalPath. LocalPath cannot be empty and must not be the root.\");\n            }\n\n            if (!_diskProvider.FolderExists(localPath.FullPath))\n            {\n                throw new DirectoryNotFoundException(\"Can't add mount point directory that doesn't exist.\");\n            }\n\n            if (existing.Exists(r => r.Host == mapping.Host && r.RemotePath == mapping.RemotePath))\n            {\n                throw new InvalidOperationException(\"RemotePath already configured.\");\n            }\n        }\n\n        public OsPath RemapRemoteToLocal(string host, OsPath remotePath)\n        {\n            if (remotePath.IsEmpty)\n            {\n                return remotePath;\n            }\n\n            var mappings = All();\n\n            if (mappings.Empty())\n            {\n                return remotePath;\n            }\n\n            _logger.Trace(\"Evaluating remote path remote mappings for match to host [{0}] and remote path [{1}]\", host, remotePath.FullPath);","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/Sonarr/Sonarr/blob/da2284d7eaab22ed9b2ca698af690148d691e967/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingService.cs#L106-L142","documentation":"ValidateMapping rejects a mapping whose Host + RemotePath pair already exists among the configured mappings. Each host/remote-path combination must be unique because the remap logic selects the first matching pair and duplicates would be ambiguous. This is an InvalidOperationException, not a usage error.","triggerScenarios":"Calling Add with a Host and RemotePath that match an existing mapping; or Update where the new Host/RemotePath collides with a different existing mapping (Update excludes the current Id from the check).","commonSituations":"Re-adding a mapping that was thought to be deleted but still cached; or editing a mapping to values that duplicate another.","solutions":["Delete or edit the existing mapping with the same Host/RemotePath before adding a new one.","If you intended a different mapping, change either the Host or the RemotePath so the pair is unique.","List current mappings (GET /api/v3/remotepathmapping) to identify the conflicting entry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"var existing = _service.All();\nif (existing.Any(r => r.Host.Equals(mapping.Host, StringComparison.OrdinalIgnoreCase) && r.RemotePath == mapping.RemotePath))\n    return Conflict(\"A mapping for this host and remote path already exists.\");","typeGuard":null,"tryCatchPattern":"try { _service.Add(mapping); }\ncatch (InvalidOperationException ex) when (ex.Message == \"RemotePath already configured.\")\n{ return Conflict(ex.Message); }","preventionTips":["List existing mappings before adding to avoid duplicates.","Delete or update the conflicting mapping rather than re-adding."],"tags":["remote-path","config","duplicate"],"backgroundTag":null,"analyzedSha":"da2284d7eaab22ed9b2ca698af690148d691e967","analyzedAt":"2026-08-13T15:53:02.562Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}