Yeah, so the most common cause is two fold: excess moisture content and inadequate sterilization. With grains it's critical they are at field capacity but dry on the outside before going into jars. Then, sterilization must be absolute -- either through extremely high temperatures such as in a PC or repeated exposure to high heat over a prolonged period such as via boiling the jars multiple times over a period of days.
Another tell tale sign is how the grain looks wet. If it's kind of a mucous-jelly type appearance, guaranteed it's bacterial. There's no recovery. I've seen Psilocybe mycelium overtake trichoderma and grey molds, but bacteria is a whole other beast. Especially the bacterias we tend to be faced with that creates antifungal compounds.
FWIW, I've confirmed a syringe I bought from a less reputable retailer is fully contaminated. I lost about a dozen jars last year to this syringe, but decided to try to get a culture going on agar. None of my other plates have germinated but that plate is exploding with bacteria across the streak pattern. It happens. Sometimes it's not you, sometimes it's your seed source.