Kareadita/Kavita · info · KavitaException
Could not grab favicon from {baseUrl.Sanitize()}
Error message
Could not grab favicon from {baseUrl.Sanitize()} What it means
Thrown inside FallbackToKavitaReaderFavicon (the curated favicon-override lookup): after loading allOverrides from favicons.txt, no line matches cleanedBaseUrl (with or without leading 'www.' and after stripping '.png'). The throw propagates up to DownloadFaviconAsync where it becomes the overall 'no favicon' failure.
Source
Thrown at Kavita.Services/Metadata/CoverDbService.cs:402
// Cache immediately
await CacheDataAsync(urlsFileName, allOverrides);
if (string.IsNullOrEmpty(allOverrides)) return correctSizeLink;
var cleanedBaseUrl = baseUrl.Replace("https://", string.Empty);
var externalFile = allOverrides
.Split("\n")
.Select(url => url.Trim('\n', '\r')) // Ensure windows line terminators don't mess anything up
.FirstOrDefault(url =>
cleanedBaseUrl.Equals(url.Replace(".png", string.Empty)) ||
cleanedBaseUrl.Replace("www.", string.Empty).Equals(url.Replace(".png", string.Empty)
));
if (string.IsNullOrEmpty(externalFile))
{
throw new KavitaException($"Could not grab favicon from {baseUrl.Sanitize()}");
}
return $"{NewHost}favicons/{externalFile}";
}
private async Task<string> FallbackToKavitaReaderPublisher(string publisherName)
{
const string publisherFileName = "publishers.txt";
var allOverrides = await GetCachedData(publisherFileName) ??
await $"{NewHost}publishers/{publisherFileName}".GetStringAsync();
// Cache immediately
await CacheDataAsync(publisherFileName, allOverrides);
if (string.IsNullOrEmpty(allOverrides)) return string.Empty;
var externalFile = allOverrides
.Split("\n")View on GitHub (pinned to 9c3e540000)
Solutions
- Confirm the favicons.txt override file was downloaded/parsed (check NewHost reachability and cache).
- Normalize the baseUrl before lookup — strip trailing slash and ports if the override list expects bare hosts.
- If the site isn't curated, accept fallback failure; contribute the site to the override list if you control it.
- As a caller, catch KavitaException and degrade to a default favicon.
Defensive patterns
Strategy: fallback
Validate before calling
var externalFile = allOverrides.Split("\n").Select(l => l.Trim('\n','\r')).FirstOrDefault(url =>
cleanedBaseUrl.Equals(url.Replace(".png", string.Empty)) ||
cleanedBaseUrl.Replace("www.", string.Empty).Equals(url.Replace(".png", string.Empty)));
if (string.IsNullOrEmpty(externalFile)) return string.Empty; Try / catch
try { link = await FallbackToKavitaReaderFavicon(baseUrl); }
catch (KavitaException ex) when (ex.Message.Contains("Could not grab favicon"))
{ link = string.Empty; } Prevention
- Confirm the favicons.txt override file downloaded and is non-empty.
- Normalize baseUrl (strip ports/trailing slash) before matching.
- Contribute missing sites to the override list if curated.
When it happens
Trigger: A baseUrl that is not present in the curated favicons.txt override list, reached only when the on-page scrape already failed. cleanedBaseUrl (https:// stripped, no .png) must match a line exactly or after removing 'www.'.
Common situations: Niche/external site not in the override list; site URL has a subdomain (the matcher only strips 'www.', not arbitrary subdomains); override list is stale or failed to download so it's empty; trailing slash or port in the URL prevents exact match.
Related errors
- Could not grab favicon from {baseUrl}
- Kavita has already tried to fetch from {sanitizedBaseUrl} an
- Could not grab publisher image for {publisherName}
- invalid-metadata-provider
- errors.font-not-found
AI-assisted analysis of Kareadita/Kavita@9c3e540000 (2026-08-13).
Data as JSON: /api/errors/c5e45b432c4e7c12.
Report an issue: GitHub.