Kareadita/Kavita · warning · KavitaException

Could not grab favicon from {baseUrl}

Error message

Could not grab favicon from {baseUrl}

What it means

Thrown at the end of DownloadFaviconAsync's fallback chain: after the HTML link-tag scrape failed or returned nothing AND FallbackToKavitaReaderFavicon(baseUrl) also returned empty, there is no favicon URL to download. The method explicitly raises KavitaException rather than returning empty so the caller knows the fetch truly failed (and so the negative cache marker is justified).

Source

Thrown at Kavita.Services/Metadata/CoverDbService.cs:153

                .Where(href => href.Split("?")[0].EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
                .ToList();

            correctSizeLink = (pngLinks?.Find(pngLink => pngLink.Contains("32")) ?? pngLinks?.FirstOrDefault());
        }
        catch (Exception ex)
        {
            _logger.LogError(ex, "Error downloading favicon.png for {Domain}, will try fallback methods", domain);
        }

        try
        {
            if (string.IsNullOrEmpty(correctSizeLink))
            {
                correctSizeLink = await FallbackToKavitaReaderFavicon(baseUrl);
            }
            if (string.IsNullOrEmpty(correctSizeLink))
            {
                throw new KavitaException($"Could not grab favicon from {baseUrl}");
            }

            var finalUrl = correctSizeLink;

            // If starts with //, it's coming usually from an offsite cdn
            if (correctSizeLink.StartsWith("//"))
            {
                finalUrl = "https:" + correctSizeLink;
            }
            else if (!correctSizeLink.StartsWith(uri.Scheme))
            {
                finalUrl = Url.Combine(baseUrl, correctSizeLink);
            }

            _logger.LogTrace("Fetching favicon from {Url}", finalUrl);
            // Download the favicon.ico file using Flurl
            var faviconStream = await FlurlConfiguration.CreateSafeRequest(finalUrl)
                .AllowHttpStatus("2xx,304")

View on GitHub (pinned to 9c3e540000)

Solutions

  1. Verify the site actually exposes a favicon and is reachable from the Kavita host (curl the baseUrl).
  2. If the site only ships .ico, that's unsupported by this parser — request the site add a .png or accept the missing icon.
  3. Check network egress / proxy / DNS from the Kavita container to the external host.
  4. As a caller, catch this and fall back to a default placeholder rather than surfacing the error to the user.
Defensive patterns

Strategy: fallback

Try / catch

try { favicon = await coverDbService.DownloadFaviconAsync(url, fmt, ct); }
catch (KavitaException ex) when (ex.Message.Contains("Could not grab favicon"))
{ favicon = null; // UI shows default favicon }

Prevention

When it happens

Trigger: A baseUrl whose HTML has no <link rel~'icon'>...href=.png> matching ValidIconRelations, and whose host is not in Kavita's remote fallback overrides list. correctSizeLink stays empty through both attempts, triggering the throw.

Common situations: Site uses only .ico (not .png) favicons and the parser only accepts .png; site blocks Kavita's user-agent; site is offline; host has no favicon at all; site is brand new and not in the curated override list.

Related errors


AI-assisted analysis of Kareadita/Kavita@9c3e540000 (2026-08-13). Data as JSON: /api/errors/fabbdb45932ad557. Report an issue: GitHub.