From 04c456e0a3330ed546d418aadf22bee00c861f2d Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma <32020192+tds-1@users.noreply.github.com> Date: Mon, 9 Feb 2026 13:27:23 +0530 Subject: [PATCH] fix: handle 404 errors gracefully in avatar download job (#13491) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Fixes `Avatar::AvatarFromUrlJob` logging 404 errors as ERROR when avatars don't exist ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --- > [!NOTE] > **Low Risk** > Small logging-only behavior change that doesn’t affect attachment flow or persisted data beyond existing sync-attribute updates. > > **Overview** > Updates `Avatar::AvatarFromUrlJob` error handling to treat `Down::NotFound` (404/missing avatar URL) as a non-error: it now logs an INFO message instead of logging as ERROR. > > Other `Down::Error` failures continue to be logged as ERROR, and the job still runs `update_avatar_sync_attributes` in `ensure`. > > Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 675f41041ae3dd4ead6e0dee5f1586dcad9750cd. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot). --- app/jobs/avatar/avatar_from_url_job.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/jobs/avatar/avatar_from_url_job.rb b/app/jobs/avatar/avatar_from_url_job.rb index 0ab7ebea8..929e76597 100644 --- a/app/jobs/avatar/avatar_from_url_job.rb +++ b/app/jobs/avatar/avatar_from_url_job.rb @@ -27,7 +27,9 @@ class Avatar::AvatarFromUrlJob < ApplicationJob content_type: avatar_file.content_type ) - rescue Down::NotFound, Down::Error => e + rescue Down::NotFound + Rails.logger.info "AvatarFromUrlJob: avatar not found at #{avatar_url}" + rescue Down::Error => e Rails.logger.error "AvatarFromUrlJob error for #{avatar_url}: #{e.class} - #{e.message}" ensure update_avatar_sync_attributes(avatarable, avatar_url)