Skip to content

[bug] Hardcover auto-fetch stats never save — CWA_DB has no execute_write(), and hardcover_auto_fetch_stats is never created #1466

Description

@itinerantsailor

Describe the bug

The Hardcover auto-fetch task can never save its stats. cps/tasks/auto_hardcover_id.py:383 calls cwa_db.execute_write(...), but CWA_DB (scripts/cwa_db.py) defines no execute_write method — so every run raises AttributeError. The surrounding except Exception at :398 downgrades it to a warning, so the task reports success and the failure is easy to miss.

There is a second layer underneath: the target table doesn't exist either.

sqlite> select count(*) from hardcover_auto_fetch_stats;
Error: in prepare, no such table: hardcover_auto_fetch_stats

hardcover_auto_fetch_stats is not created by make_tables(), so even with a working write method the INSERT at :377 would fail.

To Reproduce

  1. Configure a Hardcover API key
  2. Admin → trigger Auto-fetch Hardcover IDs (or wait for the scheduled run)
  3. Watch the container log

Actual behaviour

The task completes and reports correct counts, but logs:

WARN {cps.tasks.auto_hardcover_id:399} Error saving stats to database: 'CWA_DB' object has no attribute 'execute_write'
INFO {cps.tasks.auto_hardcover_id:165} Hardcover auto-fetch completed: 4 processed, 0 auto-matched, 4 queued for review, 0 skipped (no results), 0 errors

No row is ever written to hardcover_auto_fetch_stats.

Expected behaviour

Either the stats persist, or — if the feature was never finished — the call is removed so it stops emitting a warning on every run.

Notes

  • Not a regression. cwa_db.execute_write( is at the same call site in v4.0.6 (line 383), and CWA_DB has no execute_write in either build. Verified by grepping both images.
  • Reproduced on dev-410 (sha256:1d2d04e1…) and confirmed present in v4.0.6.
  • grep -rn "def execute_write" /app/calibre-web-automated/ returns nothing — the method does not exist anywhere in the tree, so this looks like a call that was written against an API that never landed.

Configuration

  • OS: Unraid 7.3.1, x86
  • Version: dev-410 (also present in v4.0.6)
  • Deployment: Docker, behind Nginx Proxy Manager

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions