Skip to content

fix: a failed indexer search is reported, not shown as "No torrents found" - #543

Merged
kikootwo merged 7 commits into
mainfrom
fix/522-search-failures-shown
Nov 2, 2026
Merged

kikootwo merged 7 commits into
mainfrom
fix/522-search-failures-shown

Conversation

@kikootwo

@kikootwo kikootwo commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Summary

When an indexer query failed (an HTTP 400 from Prowlarr, a timeout), searchWithVariations logged it with the [Prowlarr] module logger and dropped it. Callers could not tell "nothing found" from "the search failed": the request read "No torrents/nzbs found. Will retry automatically.", interactive search showed "No results found", and because the module logger has no job id the failure never reached the job log or System Logs. That is why #298's reporter had nothing to show us. This is the #224 follow-up.

Failed searches are now counted and reported. Automatic searches write each failure and a summary to the job log and put the count in the request message; interactive searches return the count and the modal says so above the results or the empty state, or in place of the empty state when every search failed. Results from the searches that worked are ranked and used exactly as before.

Changes

  • src/lib/integrations/prowlarr.service.ts: searchWithVariations takes an optional fifth argument, a stats out-param ({ queriesSent, queriesFailed, failures: [{ query, message }] }). Existing callers and mocks keep working without it.
  • src/lib/utils/indexer-search-failures.ts (new): the stats type, the message clean-up (error message only: the Failed to search Prowlarr: prefix dropped, any URL masked, 200 characters max), per-group warn lines, the summary line, the request message and the response summary, and recordRunFailure for a search run that throws as a whole.
  • search-indexers.processor.ts, search-ebook.processor.ts: one stats object per indexer group, summed. The job logger writes Indexer search failed: "<query>" (<group>): <message> for each failure and N of M indexer searches failed. A group whose call throws counts as one failed search. When nothing usable is found and a search failed, the request message says No torrents/nzbs found (2 of 5 indexer searches failed; see System Logs). Will retry automatically. (same suffix on "No quality matches found" and the ebook message); when every search failed, All 5 indexer searches failed (see System Logs). Will retry automatically. The blocklist message is unchanged.
  • The four interactive routes (requests/[id]/interactive-search, audiobooks/search-torrents, both interactive-search-ebook): the response carries searchFailures: { failed, total, errors } (up to 3 distinct error messages), absent when nothing failed. In both ebook routes a search run that throws counts one failed search only when no group was counted yet, so a throw after searching (in ranking, say) is not counted twice.
  • useRequests.ts: the four search hooks expose searchFailures next to error.
  • src/components/requests/SearchFailureNotice.tsx (new), InteractiveTorrentSearchModal.tsx: an amber notice in the style of the modal's error box. Some failed: "2 of 5 indexer searches failed, so results may be incomplete." above the results, or above "No results found" (with its Search Again) when the rest found nothing. All failed: "All 5 indexer searches failed, so no indexer results could be fetched." with Search Again, in place of "No results found". The error message is shown under it. The interactive routes log through route loggers, which do not persist to System Logs, so the notice shows the error itself rather than pointing there.
  • e2e/fake-arr/src/prowlarr.js: scenario knob search.queryStatuses ([{ contains, status }]) so one query can fail while another answers.
  • Docs: phase3/prowlarr.md (Failed Searches section, Fixed Issues entry), TABLEOFCONTENTS.md, testing/e2e-harness.md.

Tests

  • tests/processors/indexer-search-failures.test.ts (new): audiobook search with some queries failing writes the warn lines and the summary to the job log (persisted job events) and still queues the download from the results that came back; some failed with no results, every search failed, a group that throws, and some failed with nothing qualifying each give the expected request message; none failed leaves messages and job log unchanged. Ebook search: warn lines and the counted message, every search failed with Anna's Archive on, and none failed.
  • tests/integrations/prowlarr-search-variations.test.ts: through the real search(), an axios-style 400 (carrying the key header and a response body) ends up in the stats as the query and Request failed with status code 400 only; all queries failing are counted; no stats argument still works.
  • tests/api/audiobooks-search.routes.test.ts: the response carries the count and the distinct error, no Prowlarr key; no searchFailures when every search answered.
  • tests/api/interactive-search-ebook-query.routes.test.ts: for both ebook routes, the count in the response; a run that throws in ranking after a group was counted keeps that count (no extra failure); a run that throws before any group searched counts one failed search.
  • tests/components/requests/SearchFailureNotice.test.tsx (new): the notice above the results, the notice above "No results found" when some failed and the rest found nothing (one Search Again, the empty state's), the all-failed notice in place of "No results found" with a working Search Again, and no notice when nothing failed.
  • tests/utils/indexer-search-failures.test.ts (new): message clean-up, the request message variants, the response summary.
  • e2e/specs/regressions/522-search-failures.spec.ts (new): the automatic and interactive flows against fake Prowlarr answering 400 (see Checks); fake-arr.test.mjs covers the new search.queryStatuses knob.
  • Existing assertions on the searchWithVariations call now expect the fifth argument.
  • Fails on main: 25 of the 29 new tests fail with src at 1af0e12 (19 assert, and the 6 in the helper test file cannot load); the 4 that pass guard the "nothing failed" behaviour.

Screenshots

Interactive search where 1 of 2 indexer searches failed; results from the other are shown under the notice (1280 px):

Some searches failed, results shown

1 of 2 searches failed and the other found nothing: the notice sits above the usual empty state:

Some searches failed, nothing found

Every search failed: the notice replaces the empty state and offers Search Again:

Every search failed

The same two notices at 375 px in dark mode:

Some searches failed, 375 px dark

Every search failed, 375 px dark

Checks

  • npx vitest run on the 13 test files this change touches or that cover the modal and the ebook routes: 137 tests passed; npx vitest related --run on the changed source and test files: 139 files, 1648 tests passed.
  • npx tsc --noEmit: clean.
  • npx eslint on the changed files: nothing new.
  • npm run e2e:selftest's fake-arr tests: 19 passed, including the new search.queryStatuses test.
  • E2E harness on the built image: regressions/522-search-failures (3 tests) and smoke passed, 4 of 4. With every fake Prowlarr search answering 400, the automatic search left the request at awaiting_search with "All 2 indexer searches failed (see System Logs). Will retry automatically." and the job log held both Indexer search failed lines and "2 of 2 indexer searches failed". Interactive search showed the all-failed notice in place of "No results found", then, with only the "title author" query failing, "1 of 2 indexer searches failed" above the release, and with no releases at all the same notice above "No results found" (one Search Again), at 1280 px light and 375 px dark. No response carried the Prowlarr key.

Risk and rollback

Low. The change adds counting and messages around the existing search; the queries sent, the results kept and the ranking are unchanged, and the stats argument is optional. Request messages change only when an indexer search failed. Rollback is a revert of this PR; there is no migration.

Closes #522

🤖 Generated with Claude Code

kikootwo and others added 7 commits November 2, 2026 12:21
…ound"

searchWithVariations fills an optional stats out-param with every query
sent and every one that failed (query + error message only). Automatic
audiobook and ebook searches write one warn line per failed query and a
summary to the job log, and the request message counts the failures.
Interactive searches return the count and the modal shows a warning
above the results or in place of the empty state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uery

search.queryStatuses [{contains, status}] answers a query holding
`contains` with that status, so one query can fail while another
returns results.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ryStatuses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a failed ebook search is counted once

- The modal replaces the empty state with the failure notice only when
  every search failed; when some failed and the rest found nothing, the
  notice sits above "No results found" (one Search Again, the empty
  state's)
- Both interactive ebook routes: a search run that throws after its
  groups were counted (in ranking, say) adds no extra failure
  (recordRunFailure)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…docs

- 522-search-failures: one query 400s and the rest find nothing → the
  notice sits above "No results found" (snapshot
  search-partial-failure-empty)
- prowlarr.md: the empty state with a partial failure, recordRunFailure

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kikootwo
kikootwo marked this pull request as ready for review November 2, 2026 18:16
@kikootwo
kikootwo merged commit 580e881 into main Nov 2, 2026
1 check passed
@kikootwo
kikootwo deleted the fix/522-search-failures-shown branch November 2, 2026 18:16
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.

Search: a failed indexer query ends as "No torrents found" with no error shown

1 participant