github new-usemame/Calibre-Web-NextGen v4.0.14
v4.0.14 — Generate Kobo Auth Token Fails (blank page) fix

latest releases: v4.0.135, v4.0.134, v4.0.133...
21 days ago

Highlights

Fixes the "Generate Kobo Auth Token Fails — blank page" bug. Tracks upstream issue crocodilestick/Calibre-Web-Automated#1328 (reporter @blahblah57).

Plain-English

If clicking Profile → Create/View Kobo Auth Token gave you a blank page (with a sqlite "bad parameter" error in the server log), this release fixes it.

docker pull ghcr.io/new-usemame/calibre-web-nextgen:latest

What was wrong

The token-generation route ran query(Books).join(Data).all() (which duplicates books with multiple formats) and then accessed book.data per row, which lazy-loaded each book's formats again — N+1 queries on the request-scoped session. When a worker thread crashed mid-request, a sibling connection from the shared pool could end up in a poisoned state, and the next lazy-load failed with sqlite3.InterfaceError: bad parameter or other API misuse, blanking the page.

What changed

  • cps/kobo_auth.py — replace the join-with-duplicates + lazy-load pattern with a single joinedload(Books.data) query. One round trip, no lazy loads, no duplicates. Short-circuits when config_kepubifypath is unset (no need to walk the library at all). Wraps each per-book convert_book_format enqueue in try/except so one bad book never blank-pages the entire flow.
  • tests/smoke/test_kobo_auth_eager_load_smoke.py — 5-test regression suite that pins the structural change so a refactor can't reintroduce the lazy-load pattern.

Compare

v4.0.13...v4.0.14

Don't miss a new Calibre-Web-NextGen release

NewReleases is sending notifications on new releases.