Highlights
Fixes the Cover-file is not a valid image file, or could not be stored error when saving a cover from a Fetch-Metadata search result (Hardcover, Google Books, iTunes, Open Library, etc.).
Plain-English
If you fetched metadata for a book and tried to apply the cover and it told you the file wasn't a valid image — even though it clearly was — this release fixes that. After upgrading, fetch metadata, pick a cover, hit Save, and it sticks.
docker pull ghcr.io/new-usemame/calibre-web-nextgen:latest
What was wrong
The container has two privilege domains: Calibre-Web Flask runs as abc (PUID 1000), but the s6 services that watch the ingest folder and run calibredb/ebook-polish after metadata changes run as root. When those root-running services touched a per-book directory, files ended up root:root, and Calibre-Web couldn't overwrite cover.jpg afterwards. The PermissionError got caught generically and surfaced as the vague "not a valid image" message.
This was especially likely to bite users running with NETWORK_SHARE_MODE=true, because that mode skips the startup chown sweep.
What changed
scripts/cover_enforcer.py— at the end of each per-bookenforce_cover()pass, chown the book dir + its files back toPUID:PGID(defaults1000:1000, env-overridable). Self-heals on every metadata-change cycle, no separate cron needed.cps/helper.py— real diagnostics on cover-save failures: log target path + exception class on filesystem errors, broaden the exception catch beyondIOError/OSErrorso wand/PIL errors no longer masquerade as filesystem issues, log URL + status + content-type + bytes on download success, and abort early with a specific log line when the response body is 0 bytes.
Upgrade notes
If you've already accumulated root:root-owned book directories from before this release, do this once after upgrading:
docker exec <container> chown -R abc:abc /calibre-library
(Replace abc with your PUID/PGID user if you've customized those.)