Active Storage is a great feature, but sometimes it can fail us. There was an issue discovered where an uploaded image may not be a valid kind of image which can be resized. In this case, an error would be thrown. The solution to handle variants and making sure that the image can be resized appropriately is to check to see if it is not only attached, but also variable.
record.image.attached? && record.image.variable?