Release Notes: v4.0.1
This release is a hotfix that mainly focuses on database stability, EPUB compatibility, and automated maintenance while fixing numerous other bugs. I’ve also addressed critical race conditions during migrations and improved how the application handles metadata synchronization and ingest workflows (mainly for those running the new NETWORK_SHARE_MODE.
🚀 New Features & Enhancements
- Scheduled Maintenance: Added a new background task (
TaskCleanArchivedBooks) to purge stale archived references. Configure maintenance schedules via the CWA Settings UI (default 03:00 local). - Harden Ingest Flow: Sidecar manifest files are now ignored to prevent premature deletion.
- Improved "skip-delete" handling for temporary artifacts during readiness timeouts.
- Implemented robust stale temp cleanup with configurable age and interval settings.
- UI & UX Improvements: Renamed "Categories" to "Tags / Categories" in the bulk edit modal with updated multi-value instructions.
- Unified the homepage filter header styling with the standard shelf-actions wrapper.
- Updated all copyright years to 2026 for Calibre-Web and CWA contributors.
EPUB Reader & File Handling
- Enhanced Fixer Safety: The default EPUB fixer has been completely overhauled to be "safe by default." It now uses advanced encoding detection to preserve original file integrity and performs targeted repairs (like removing stray
<img>tags) without risky full-file reserialization. - New "Aggressive" Mode: Introduced a
kindle_epub_fixer_aggressivetoggle in the settings UI. This allows users to opt-in to more intensive transforms and duplicate XML declaration repairs for severely malformed files that fail Send-to-Kindle (E999) or crash the internal reader. - Reader Stability: The Web UI reader now includes guards against invalid
container.xmlstates and provides clear error messaging instead of an endless loading spinner when encountering corrupted EPUB structures.
🛠 Bug Fixes
Database & Stability
- Migration Lockups: Fixed
sqlite3.OperationalErrorwhere migrations locked the DB during startup. Added safe rollbacks and retry wrappers forALTER TABLEstatements. - Session Management: Resolved "transaction is closed" errors during metadata saves and fixed an
AttributeErrorwhere the Calibre session wasNoneduring startup/upgrade races. (Fixes #947, #943) - Startup Healthchecks: Introduced an
app.dbhealthcheck at startup to flag missing, non-writable, or locked DBs early. - DB Path Resolution: Hardened
app.dbresolution logic to prevent mismatched DB usage across services (e.g., accidentally usingcwa.db). - Archived Book Sync: Deleting an archived book now correctly removes its entry from the
archived_booktable. (Fixes #8243)
Metadata & Web UI
- Save Flakiness: Fixed an issue where "Save" appeared to work but didn't persist if TinyMCE/Rating widgets weren't ready. Added a sync trigger on form submit. (Fixes #948)
- Pagination & Sorting: * Fixed "inflated" book counts on the homepage caused by duplicate rows in database joins. (Fixes #766)
- Fixed "duplicate scan" crashes caused by comparing timezone-aware vs naive timestamps. (Fixes #945)
- Date Display: Fixed a bug where the published date rendered as the prior day due to timezone offsets. (Fixes #789)
- Stats Dashboard: Resolved "Unknown User" entries in dropdowns by properly mapping activity logs to current user IDs. (Fixes #942)
Reader & File Handling
- EPUB Repair: * The reader now auto-repairs and validates invalid
container.xmlfiles (e.g., duplicate XML declarations) that causedepub.jsto crash.- Improved EPUB fixer safety by preserving original file encodings and adding better UTF-8/UTF-16 detection.
- Auto-Zip Backups: Switched to
shutil.copyto resetmtimeso that daily auto-zips correctly include new backups. (Fixes #260) - Magic Shelves: Fixed negated tag filters (e.g., "does not contain tag") which were failing to exclude books correctly.
Integrations & Config
- Hardcover.app: Fixed layout issues (0px height), Isotope initialization errors, and button failures on the review matching page. Allowed
https:images in CSP for reviews. - Cover Enforcer: Fixed an infinite loop where failed logs were re-processed indefinitely; failures are now logged to CWA stats. (Fixes #829)
- DB Config: Fixed styling issues on the Config page and prevented crashes when the Calibre directory path was missing or empty. (Fixes #870, #779)