Skip to content

fix: graceful per-provider failure handling#316

Open
sloth-of-all-trades wants to merge 1 commit into
Snd-R:masterfrom
sloth-of-all-trades:fix/graceful-provider-failure
Open

fix: graceful per-provider failure handling#316
sloth-of-all-trades wants to merge 1 commit into
Snd-R:masterfrom
sloth-of-all-trades:fix/graceful-provider-failure

Conversation

@sloth-of-all-trades

Copy link
Copy Markdown

When a metadata provider fails (403, 500, timeout, Cloudflare block), the error is now caught and logged for that provider only. The search, match, and aggregation operations continue with remaining providers instead of aborting the entire operation with a 500 error.

Problem

When any single provider throws an exception (e.g. BookWalker returns 403 from Cloudflare, AniList rate-limits with 403, MangaUpdates image server 500s), the entire metadata operation aborts and returns a 500 error to the UI. This happens even when the failed provider is not the one being used for identification.

Fixes #216

Changes

Patched MetadataService.kt in 4 places:

  1. searchSeriesMetadata (both overloads): Wrapped each provider async call in try/catch. Failed providers return empty results instead of propagating the exception.

  2. matchSeries: Changed from throw ProviderException to log the error, emit a ProviderErrorEvent, and return null. This allows the firstNotNullOfOrNull loop to continue to the next provider.

  3. getBookMetadata: Changed from throw ProviderException to log and return partial metadata (null for failed books) instead of aborting.

  4. aggregateMetadataFromProviders: Wrapped each provider async call in try/catch. Failed providers are skipped instead of crashing the aggregation.

Testing

Built and deployed on a live Komga instance. BookWalker (Cloudflare-blocked, 403) and AniList (rate-limited, 403) now fail gracefully. Search returns 200 OK with results from remaining providers (VIZ, MangaUpdates, MangaDex, YenPress). No 500 errors.

When a metadata provider fails (403, 500, timeout, Cloudflare block),
the error is now caught and logged for that provider only. The search
/match / aggregation continues with remaining providers instead of
aborting the entire operation with a 500 error.

Fixes Snd-R#216
@sloth-of-all-trades

Copy link
Copy Markdown
Author

@Snd-R could this be merged to improve the overall stability? The current implementation throws an error, and fails the whole search.

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.

Failed identification when a single source fails

1 participant