Some GIF thumbnails got broken

We are using this awesome product for more than a year, everything was great and mostly bug-free, but recently we found a strange issue with some GIF uploads (possibly other formats too, but so far found only GIFs): several GIFs had broken thumbnails (not loading, iirc 404). The original/full size image was opening fine when clicking on it. There were about 5 such GIFs of 30 total (not sure how much of these 30 had thumbnails, but there definitely were some with working thumbnails), and all of them were quite old, Dec 2019 - Mar 2020.

Rebaking posts seems to fix this issue, so I simply opened rails c, checked all posts with GIFs found by

Post.where("raw like '%.gif)%'").map { |p| [, p.topic_id, p.post_number, p.baked_at, p.raw.truncate(100)] }

and rebaked all broken ones


Any ideas what could cause this or how to debug this?