Kareadita/Kavita · error · KavitaException
errors.font-not-found
Error message
errors.font-not-found
What it means
Thrown by FontService.CreateFontsFromUrl when GetGoogleFontsMetadataAsync(fontFamily) returns null after successfully passing the URL prefix check. The font family name extracted from the URL does not match any entry in Google's font metadata, meaning the family name is misspelled, deprecated, or does not exist on Google Fonts.
Source
Thrown at Kavita.Services/FontService.cs:177
return new FontDeleteResultDto {Deleted = true, InUse = inUse};
}
public async Task<EpubFont[]> CreateFontsFromUrl(string url, CancellationToken ct = default)
{
if (!url.StartsWith(SupportedFontUrlPrefix))
{
throw new KavitaException("font-url-not-allowed");
}
// Extract Font name from url
var fontFamily = url.Split(SupportedFontUrlPrefix)[1].Split("?")[0].Split("/").Last();
logger.LogInformation("Preparing to download {FontName} font", fontFamily.Sanitize());
var metaData = await GetGoogleFontsMetadataAsync(fontFamily);
if (metaData == null)
{
logger.LogError("Unable to find metadata for {FontName}", fontFamily.Sanitize());
throw new KavitaException("errors.font-not-found");
}
// Choose the variable font if available
// Otherwise take the full list.
// This should be fine since Google Fonts seems to
// only prepend filenames with 'static/' for font
// families that have variable fonts since the
// static/ path contains non-variable variants of
// the font for applications that don't support
// variable fonts.
var googleFontRefs = metaData.VariableFont();
if (googleFontRefs.Length == 0)
{
googleFontRefs = metaData.manifest.fileRefs;
}
var finalRef = new List<EpubFont>();
foreach (var fontRef in googleFontRefs)View on GitHub (pinned to 9c3e540000)
Solutions
- Verify the font family exists on Google Fonts by visiting the URL in a browser
- Copy the URL directly from the Google Fonts website rather than typing it manually
- Check for typos in the font family name (e.g., 'Robot' instead of 'Roboto')
- If the network is restricted, ensure the server can reach Google Fonts metadata endpoints
Example fix
// Verify the font exists before calling:
// var metadata = await GetGoogleFontsMetadataAsync(fontFamily);
// if (metadata == null) {
// toast.error(`Font '${fontFamily}' not found on Google Fonts. Check the name.`);
// return;
// } Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-validate the font family name against Google Fonts metadata:
// var fontFamily = ExtractFamilyNameFromUrl(url);
// var metadata = await GetGoogleFontsMetadataAsync(fontFamily);
// if (metadata == null) {
// return BadRequest($"Font '{fontFamily}' was not found on Google Fonts. Verify the name and URL.");
// } Try / catch
// try {
// var fonts = await fontService.CreateFontsFromUrl(url, ct);
// return Ok(fonts);
// } catch (KavitaException ex) when (ex.Message == "errors.font-not-found") {
// return BadRequest(new { error = "The specified font family could not be found on Google Fonts. Check the URL and family name." });
// } Prevention
- Always copy the font URL directly from the Google Fonts website rather than typing it
- Verify the font family page loads in a browser before submitting the URL
- Handle null metadata responses gracefully with clear user-facing error messages
- Log the extracted font family name to aid debugging when metadata lookups fail
When it happens
Trigger: User types a font family name that doesn't exist on Google Fonts; the family name has a typo or incorrect capitalization; the font was removed from Google Fonts; the URL path structure doesn't yield a parseable family name.
Common situations: User manually types a font URL with a guessed family name; font family name has spaces or special characters that the URL parsing splits incorrectly; Google Fonts API response format changed; network issue causes metadata fetch to return null.
Related errors
- font-url-not-allowed
- library-doesnt-exist
- invalid-metadata-provider
- client-device-doesnt-exist
- collection-doesnt-exist
AI-assisted analysis of Kareadita/Kavita@9c3e540000 (2026-08-13).
Data as JSON: /api/errors/c4ca6c17e6235272.
Report an issue: GitHub.