It's not a matter of if, but when will you suffer contamination when growing mushrooms. When growing as a hobbyist, we are fighting a losing battle against contamination. We live in non-sterile environments. We have pets. Mold and fungus spores are ubiquitous except in the highest levels of clean rooms. It's bound to happen , even to the most fastidious of us. Even if we do everything right, the spores or cultures we use can hide contamination that ruins our attempt.
But there are things we can do to avoid it to a large extent. My fist recommendation would be to use our All-In-One grow bags. They do a great job of mitigating as many external vectors for contamination as possible. The only real risks are either from the spores/culture or during the act of injecting them into the bag. But even those can be mitigated by testing the culture on agar, and being sure to apply 70% alcohol to the needle and injection site right before we inoculate.
Going further, we can turn the heating/cooling system and fans off, do the work in a room with still air, or even build and do the work in a still air box. Home HEPA filters are great for indoor air quality.
Even though contamination is inevitable if we grow long enough, using the proper procedures can reduce our chances drastically. It's attainable for the home grower to reach a level of success above 98 or even 99%. Though, as any chemist will attest, the last .5% is the hardest.