Repository navigation
Description
Pending author imports retry forever (MaxAttempts = 0), re-refresh the whole author every ~5 min, and can't be seen or cancelled
Version: Chaptarr 0.9.1000.0, Docker image chaptarr/chaptarr:develop
Host: Synology DS920+ (Intel Celeron J4125, 4 cores), SQLite database (~800 MB)
Summary
When an author import is waiting on something the metadata server doesn't have yet, the PendingAuthorImport row is retried every ~5 minutes with no limit (MaxAttempts = 0) and no backoff. Each attempt runs a full RefreshAuthorService pass over the author's entire catalog, even though only one work is missing. These pending imports don't appear anywhere in the UI, and I found no API endpoint for them, so the only way to stop them was to edit chaptarr.db by hand with Chaptarr stopped.
Steps to reproduce
- Import an author from the UI while asking for a specific audiobook work that isn't (yet) in the metadata server's author catalog, or
- Import an author by a Hardcover ID (
hc:…) that the metadata server doesn't know yet. - Leave Chaptarr running.
Expected
- Retries back off (e.g. exponential, capped at ~24 h) and stop after a sensible default number of attempts, then mark the import Failed.
- Pending author imports are listed somewhere (Activity/Queue or System) with a Cancel/Remove button, and are exposed in the API.
- An attempt only checks whether the missing work/author now exists, and does a full author refresh only once it does.
Actual
Four rows in PendingAuthorImport, all OverallStatus = 3 (retrying), MaxAttempts = 0:
| Id | Provider | Author | Waiting for | Created | AttemptCount |
|---|---|---|---|---|---|
| 56 | gr:XXXXXXXX | Charles Dickens | 1 audiobook work not in the author catalog | 2026-10-06 | 8,727 |
| 58 | hc:XXXXXX | "Pending Import" | author not on the metadata server | 2026-10-19 | 5,813 |
| 60 | gr:XXXXXXXX | Jane Austen | 1 audiobook work not in the author catalog | 2026-11-05 | 1,538 |
| 61 | gr:XXXXXXXX | Mary Shelley | 1 audiobook work not in the author catalog | 2026-11-06 | 1,520 |
NextAttemptAt is consistently ~5–6 minutes after LastAttemptAt. Row 56 hit 8,727 attempts in ~36 days.
Each attempt refreshes the whole author, here twice in one attempt (24 books each pass), and the attempt took ~29 s:
[Info] ProcessPendingImportsCommandHandler: Processing pending import 56 for provider gr:XXXXXXXX
[Info] AuthorLibraryService: Author 'Charles Dickens' already exists in database with 27 books (audiobook=True, ebook=False)
[Info] RefreshAuthorService: Checking Info for Charles Dickens
[Info] RefreshAuthorService: GetRemoteChildren: Returning 24 books (from 64 total, 64 de-duped, 28 profile-filtered, 4 excluded, retained editions applied)
[Info] RefreshBookService: Checking Info for Oliver Twist
[Info] RefreshBookService: Checking Info for Great Expectations
... (all 24 books)
[Error] RefreshBookService: Book [108606][Bleak House] was not found, it may have been removed from Metadata sources.
[Error] RefreshBookService: Book [170235][Little Dorrit] was not found, it may have been removed from Metadata sources.
[Info] AuthorLibraryService: Author 'Charles Dickens' already exists in database with 27 books (audiobook=True, ebook=False)
[Info] RefreshAuthorService: Checking Info for Charles Dickens
... (same 24 books again)
[Warn] ProcessPendingImportsCommandHandler: Pending author import gr:XXXXXXXX retained: Requested Audiobook work gr:XXXXXXXX is not yet present in the authoritative author catalog.
[Warn] PendingAuthorImportService: Pending import 56 attempt 8725 waiting until 11/12/2026 00:11:08: Requested Audiobook work gr:XXXXXXXX is not yet present in the authoritative author catalog.
[Info] ProcessPendingImportsCommandHandler: Pending import 56 attempt finished as Retrying: 1 work lookups, 0 targets handed to the primary queue, 28976 ms
[Warn] ProcessPendingImportsCommandHandler: Author hc:XXXXXX not yet available on metadata server, scheduling retry
[Warn] PendingAuthorImportService: Pending import 58 attempt 5810 waiting until 11/12/2026 00:11:25: Author not yet available on metadata server
Impact
- Chaptarr sat at a constant 20–40% CPU on a J4125 and used ~4.5 hours of CPU time in about a day, with nothing else going on in Chaptarr. This was a big part of the NAS feeling sluggish.
- Thousands of avoidable metadata-server requests (every attempt re-fetches the author and all its books).
- Logs fill with the same refresh output every few minutes.
- Invisible to the user: nothing in the UI shows these imports exist.
Workaround
With Chaptarr stopped and the database backed up:
DELETE FROM PendingAuthorImport WHERE Id IN (56, 58, 60, 61);
After restarting, CPU went back to normal and the retry loop stopped.
Suggested fix
- Give
MaxAttemptsa real default (e.g. 20) and/or exponential backoff capped at ~24 h. Mark the import Failed when it runs out. - On retry, first check cheaply whether the missing work/author now exists. Only run
RefreshAuthorServiceonce it does, and only once per attempt (it currently runs twice). - Expose pending author imports in the UI and API (list, retry now, cancel).
- Log the "not yet available" warning once per import, then at Debug on later attempts.
Activity
edsilberberg commentedon Nov 12, 2026
I think I found it in the UI under Author requests, however it was driving me crazy as well I was on pass number 5000 of the same author and it was clawing in the logs and slowing down my import. But thanks to your bug entry and when I deleted the pending author my import sped up
http://192.168.x.x:8788/wanted/authors
elric667 commentedon Nov 13, 2026
So glad this helped it was driving me crazy until I found the problem.
elric667 commentedon Nov 13, 2026
For whoever picks this up: #264 and #119 describe the same unbounded PendingAuthorImport retry (MaxAttempts = 0) from different angles. #264 adds that the retry path never checks ImportListExclusions and can recreate deleted authors as monitored; #119 adds the SQLite lock cascade on large libraries. It may be easiest to fix all three together.
#368 is a small first step: it keeps the retries but backs them off after the first hour.