{"record":{"id":"aaf2e61bf5a1aaca","repo":"Radarr/Radarr","slug":"url-no-longer-in-cache","errorCode":null,"errorMessage":"Url no longer in cache","messagePattern":"Url no longer in cache","errorType":"exception","errorClass":"KeyNotFoundException","httpStatus":null,"severity":"warning","filePath":"src/NzbDrone.Core/MediaCover/MediaCoverProxy.cs","lineNumber":56,"sourceCode":"            }\n\n            var hash = url.SHA256Hash();\n\n            _cache.Set(hash, url, TimeSpan.FromHours(24));\n\n            _cache.ClearExpired();\n\n            var fileName = Path.GetFileName(url);\n            return _configFileProvider.UrlBase + @\"/MediaCoverProxy/\" + hash + \"/\" + fileName;\n        }\n\n        public string GetUrl(string hash)\n        {\n            var result = _cache.Find(hash);\n\n            if (result == null)\n            {\n                throw new KeyNotFoundException(\"Url no longer in cache\");\n            }\n\n            return result;\n        }\n\n        public async Task<byte[]> GetImage(string hash)\n        {\n            var url = GetUrl(hash);\n\n            var request = new HttpRequest(url);\n            var response = await _httpClient.GetAsync(request);\n\n            return response.ResponseData;\n        }\n    }\n}\n","sourceCodeStart":38,"sourceCodeEnd":73,"githubUrl":"https://github.com/Radarr/Radarr/blob/ca451608dc60c6cec754aba8d96bfa30e9468ed5/src/NzbDrone.Core/MediaCover/MediaCoverProxy.cs#L38-L73","documentation":"MediaCoverProxy keeps a 24-hour in-memory cache mapping a SHA256 hash of a cover-art URL to the original URL. GetUrl throws KeyNotFoundException when the hash is not present because the entry expired or was never registered (the cache is lost on every process restart).","triggerScenarios":"GetUrl/GetImage is called with a hash whose cache entry has expired (>24h) or was never set, most often after an application restart while a stale /MediaCoverProxy/{hash}/... URL is still being requested by a client or cached UI.","commonSituations":"Browser/app caches an old proxy URL across a Radarr restart, a URL older than 24h, or a directly bookmarked proxy link; the in-memory cache does not survive restarts.","solutions":["Re-request the cover through the normal MediaCover endpoint so it is re-registered and a fresh hash issued.","Reload the movie/detail page or clear the client cache so stale proxy URLs are discarded.","Treat the proxy as best-effort; missing covers auto-recover on next refresh."],"exampleFix":"// before: using a stale hash after restart\nvar bytes = await proxy.GetImage(oldHash);\n\n// after: re-register to obtain a valid hash, fall back gracefully\nvar freshUrl = proxy.RegisterUrl(originalUrl);\nvar bytes = freshUrl == null ? null : await proxy.GetImage(extractHash(freshUrl));","handlingStrategy":"fallback","validationCode":"if (!cacheFound) { url = proxy.RegisterUrl(originalUrl); }","typeGuard":null,"tryCatchPattern":"try { return await proxy.GetImage(hash); }\ncatch (KeyNotFoundException) { return Array.Empty<byte>(); /* re-register on next cover refresh */ }","preventionTips":["Re-register URLs through the normal MediaCover flow after restarts.","Treat proxy URLs as short-lived (24h).","Avoid persisting proxy URLs in clients."],"tags":["cache","media-cover","proxy"],"backgroundTag":null,"analyzedSha":"ca451608dc60c6cec754aba8d96bfa30e9468ed5","analyzedAt":"2026-08-13T17:21:54.115Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}