Scanner reports cover images (cover.jpg/cover.png) as Media Issues
What happened?
After upgrading to 0.9.1, the Media Issues page started listing entries that do not correspond to any real problem:
| filePath | extension | comment |
|---|---|---|
| cover.png | PNG | Unable to parse any meaningful information out of file |
| cover.jpg | JPG | Unable to parse any meaningful information out of file |
These are ordinary cover images sitting next to the content, and the scanner is supposed to skip them. The problem is how the skip is signalled.
Both BasicParser and ComicVineParser deliberately return null for cover images:
Kavita.Services/Scanner/BasicParser.cs
if (type != LibraryType.Image && Parser.IsCoverImage(directoryService.FileSystem.Path.GetFileName(filePath))) return null;Kavita.Services/Scanner/ComicVineParser.cs
// Mylar often outputs cover.jpg, ignore it by default
if (string.IsNullOrEmpty(fileName) || Parser.IsCoverImage(directoryService.FileSystem.Path.GetFileName(filePath))) return null;But the caller cannot tell "deliberately skipped" from "failed to parse", because both
are just null:
Kavita.Services/Reading/ReadingItemService.cs
var info = Parse(path, rootPath, libraryRoot, type, enableMetadata);
if (info == null)
{
_logger.LogError("Unable to parse any meaningful information out of file {FilePath}", path);
_mediaErrorService.ReportMediaIssue(Path.GetFileName(path), MediaErrorProducer.Scanner,
"Unable to parse any meaningful information out of file", string.Empty);
return null;
}So every cover image produces a LogError plus a Media Issue row on every scan.
Why this shows up now
The ReportMediaIssue call was added in #4582 (commit f76bbe85, released in v0.9.0).
It went unnoticed for a full release cycle because GetMediaErrors was missing an
await in v0.9.0 / v0.9.0.2:
public ActionResult<PagedList<MediaErrorDto>> GetMediaErrors()
{
return Ok(unitOfWork.MediaErrorRepository.GetAllErrorDtosAsync());
}That serialised the Task object rather than the list, so the Media Issues page was
effectively blank for everyone on 0.9.0.x. The await was added incidentally in
commit 751f3126 (#4752) and shipped in v0.9.1.0 — which is why the backlog of
false positives becomes visible on upgrade.
What did you expect?
Cover images should be skipped silently. They are not a media problem, so they should
not appear on the Media Issues page and should not be logged at Error level.
The underlying issue is that null is overloaded to mean two different things. A
couple of ways to fix it:
- Check
Parser.IsCoverImage(...)inReadingItemService.ParseFilebefore callingParse, and return early without reporting. - Or let the parsers distinguish "skipped" from "failed" — a sentinel/enum result, or
a separate
ShouldSkipcheck — so only genuine failures reachReportMediaIssue.
Kavita Version Number
0.9.1 - Stable
Are you accessing kavita through a reverse proxy?
Yes (Nginx Proxy Manager)
What operating system is Kavita being hosted from?
Docker (LSIO Container)
Relevant log output
[Error] Kavita.Services.Reading.ReadingItemService Unable to parse any meaningful information out of file /path/to/cover.jpgAdditional Notes
Reproduction: put a cover.jpg (or cover.png) inside a series folder in any library
whose type is not Image — Manga and ComicVine both reproduce it — and run a scan.
The file is correctly skipped, but a Media Issue is recorded for it.
Seen on two libraries here, one Manga and one ComicVine.
Source: Kareadita/Kavita