From 0fa10941e1ccaadc3cbb3f31060f13da112ec00a Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 22 Dec 2025 15:53:15 +0000 Subject: [PATCH] Handle 409 from editCategory as non-error qBittorrent's /torrents/editCategory endpoint returns 409 (Conflict) when the category already has the specified save path (no change needed). This is expected behavior when: - User hasn't changed download_dir setting since last torrent - Category already has correct save path Previously logged as warning with full error stack trace, making it look like an error when it's actually normal operation. Changes: - Check for 409 status code from editCategory - Log friendly message: 'Category already has save path: /path' - Only log unexpected errors with console.warn Now both createCategory and editCategory handle 409 gracefully: - createCategory 409 = category exists - editCategory 409 = category already has this path Both are expected, not errors. --- src/lib/integrations/qbittorrent.service.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/integrations/qbittorrent.service.ts b/src/lib/integrations/qbittorrent.service.ts index 963b965..7938dbe 100644 --- a/src/lib/integrations/qbittorrent.service.ts +++ b/src/lib/integrations/qbittorrent.service.ts @@ -423,8 +423,13 @@ export class QBittorrentService { console.log(`[qBittorrent] Category "${category}" save path updated to: ${this.defaultSavePath}`); } catch (error) { - console.warn(`[qBittorrent] Failed to update category save path:`, error); - // Don't throw - torrents can still be added with per-torrent savepath parameter + // 409 = category already has this save path (expected, not an error) + if (axios.isAxiosError(error) && error.response?.status === 409) { + console.log(`[qBittorrent] Category "${category}" already has save path: ${this.defaultSavePath}`); + } else { + console.warn(`[qBittorrent] Failed to update category save path:`, error); + // Don't throw - torrents can still be added with per-torrent savepath parameter + } } }