Kareadita/Kavita · warning · KavitaException
invalid-metadata-provider
invalid-metadata-provider
Error message
invalid-metadata-provider
What it means
Thrown by LibraryController.ValidateMetadataProvider when the supplied MetadataProvider is not valid for the given LibraryType, per KavitaPlusConfiguration.MetadataProvidersForLibraryTypes (e.g. only Mangabaka for Manga, Hardcover/ComicBookRoundup for Comic). A KavitaException surfacing as HTTP 500 with 'invalid-metadata-provider'.
Source
Thrown at Kavita.Server/Controllers/LibraryController.cs:774
library.LibraryFileTypes = dto.FileGroupTypes
.Select(t => new LibraryFileTypeGroup() {FileTypeGroup = t, LibraryId = library.Id})
.Distinct()
.ToList();
library.LibraryExcludePatterns = dto.ExcludePatterns
.Distinct()
.Select(t => new LibraryExcludePattern() {Pattern = t, LibraryId = library.Id})
.ToList();
unitOfWork.LibraryRepository.Update(library);
}
private static void ValidateMetadataProvider(LibraryType type, MetadataProvider provider)
{
if (!KavitaPlusConfiguration.MetadataProvidersForLibraryTypes.TryGetValue(type, out var validProviders) || !validProviders.Contains(provider))
{
throw new KavitaException("invalid-metadata-provider");
}
}
/// <summary>
/// Returns the type of the underlying library
/// </summary>
/// <param name="libraryId"></param>
/// <returns></returns>
[LibraryAccess]
[HttpGet("type")]
public async Task<ActionResult<LibraryType>> GetLibraryType(int libraryId)
{
var ct = HttpContext.RequestAborted;
return Ok(await unitOfWork.LibraryRepository.GetLibraryTypeAsync(libraryId, ct));
}
}
View on GitHub (pinned to 9c3e540000)
Solutions
- Choose a MetadataProvider that the library's LibraryType allows per MetadataProvidersForLibraryTypes.
- Fetch valid providers via the endpoint that returns MetadataProvidersForLibraryTypes for the type, then restrict the UI selector.
- Keep the client's provider list in sync with the server map (note the source comment to adjust UI when the map changes).
Example fix
// before - Hardcover not valid for Manga ValidateMetadataProvider(LibraryType.Manga, MetadataProvider.Hardcover); // after - Mangabaka is the allowed provider for Manga ValidateMetadataProvider(LibraryType.Manga, MetadataProvider.Mangabaka);
Defensive patterns
Strategy: validation
Validate before calling
if (!KavitaPlusConfiguration.MetadataProvidersForLibraryTypes
.TryGetValue(type, out var valid) || !valid.Contains(provider))
return BadRequest("invalid-metadata-provider"); Type guard
static bool IsValidProvider(LibraryType t, MetadataProvider p)
=> KavitaPlusConfiguration.MetadataProvidersForLibraryTypes
.TryGetValue(t, out var set) && set.Contains(p); Try / catch
try { ValidateMetadataProvider(type, provider); }
catch (KavitaException) { return BadRequest("invalid-metadata-provider"); } Prevention
- Fetch valid providers for the type from the server before rendering the selector.
- Recompute the allowed set client-side when the LibraryType changes.
- Update the client map whenever the server MetadataProvidersForLibraryTypes changes.
When it happens
Trigger: A library update/create call sets a MetadataProvider not in the allowed set for that LibraryType — e.g. choosing Hardcover for a Manga library, or ComicBookRoundup for LightNovel when unsupported.
Common situations: UI offers a provider combo invalid for the library type; the MetadataProvidersForLibraryTypes map changed across versions but the client wasn't updated; misconfigured Kavita Plus provider selection.
Related errors
- {comparison} is not applicable for {fieldName}
- Name must be set
- You cannot use the name of a system provided stream
- delete-library-while-scan
- library-doesnt-exist
AI-assisted analysis of Kareadita/Kavita@9c3e540000 (2026-08-13).
Data as JSON: /api/errors/9b003f0db7d1c71a.
Report an issue: GitHub.