Repository navigation
fix: a failed indexer search is reported, not shown as "No torrents found" - #543
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When an indexer query failed (an HTTP 400 from Prowlarr, a timeout),
searchWithVariationslogged 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:searchWithVariationstakes 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: theFailed 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, andrecordRunFailurefor 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 writesIndexer search failed: "<query>" (<group>): <message>for each failure andN 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 saysNo 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.requests/[id]/interactive-search,audiobooks/search-torrents, bothinteractive-search-ebook): the response carriessearchFailures: { 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 exposesearchFailuresnext toerror.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 knobsearch.queryStatuses([{ contains, status }]) so one query can fail while another answers.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 realsearch(), an axios-style 400 (carrying the key header and a response body) ends up in the stats as the query andRequest failed with status code 400only; 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; nosearchFailureswhen 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.mjscovers the newsearch.queryStatusesknob.searchWithVariationscall now expect the fifth argument.srcat 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):
1 of 2 searches failed and the other found nothing: the notice sits above the usual empty state:
Every search failed: the notice replaces the empty state and offers Search Again:
The same two notices at 375 px in dark mode:
Checks
npx vitest runon the 13 test files this change touches or that cover the modal and the ebook routes: 137 tests passed;npx vitest related --runon the changed source and test files: 139 files, 1648 tests passed.npx tsc --noEmit: clean.npx eslinton the changed files: nothing new.npm run e2e:selftest's fake-arr tests: 19 passed, including the newsearch.queryStatusestest.regressions/522-search-failures(3 tests) andsmokepassed, 4 of 4. With every fake Prowlarr search answering 400, the automatic search left the request atawaiting_searchwith "All 2 indexer searches failed (see System Logs). Will retry automatically." and the job log held bothIndexer search failedlines 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