I’ve had it happen to me a few times, usually when trying to paste an image I snagged from somewhere else. If I save the image to my desktop first, it seems OK, though I’m sure it is dependent on exactly what’s broken about the image.
Bottom line is that discourse really wants JPG. It’ll try to convert PNG to JPG for you, but if it can’t for whatever reason, that error is what you get.