Skip to content

Fix misleading "already requested" error on in-progress downloads - #291

Closed
zpersichetti wants to merge 2 commits into
kikootwo:mainfrom
zpersichetti:fix/user-section-download-duplicate-request
Closed

zpersichetti wants to merge 2 commits into
kikootwo:mainfrom
zpersichetti:fix/user-section-download-duplicate-request

Conversation

@zpersichetti

Copy link
Copy Markdown
Contributor

Problem

In the user (non-admin) section, clicking "Download" on an audiobook that already
has a request in an in-progress state (downloading / processing) — or one awaiting
admin approval — returns the misleading "You have already requested this audiobook"
error. The same action works in the admin section because it routes through
select-torrent on the existing request.

Root cause

request-with-torrent's first check only matched completed statuses
(downloaded / available). Requests in downloading / processing / awaiting_approval
fell through to the later duplicate-request check, whose re-request whitelist is
only ['failed', 'warn', 'cancelled'], producing the generic "already requested"
message.

Fix

Extend the first check to also catch downloading, processing, and
awaiting_approval, returning status-appropriate errors:

  • downloading / processing -> BeingProcessed
  • awaiting_approval -> AwaitingApproval

The frontend already handles BeingProcessed and surfaces data.message for other
error codes, so no frontend change is needed.

Testing

npm ci && tsc --noEmit passes cleanly.

The request-with-torrent duplicate check only whitelisted
failed/warn/cancelled for re-request, so a book with an in-flight request
(downloading/processing) or one awaiting approval fell through to the
misleading 'You have already requested this audiobook' message.

Extend the first check to also catch downloading/processing/awaiting_approval
and return status-appropriate errors (BeingProcessed / AwaitingApproval).
@kikootwo

Copy link
Copy Markdown
Owner

Thanks @zpersichetti, good catch on the root cause.

I'm landing this together with the #281 fix, with you as co-author. The tests are getting tightened a bit, and the error wording is being adjusted so it reads right for Audiobookshelf users too.

Leaving this open until that lands.

@kikootwo

Copy link
Copy Markdown
Owner

@zpersichetti thanks for this! It landed in #463 with you as co-author, together with the ebook side of the same problem, so I'm closing this one. It'll be in the next release.

@kikootwo kikootwo closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants