This is a loaded question, as it always seems to be with cannabis, and has a lot of factor to consider.
I’m assuming most people reading this a smokers rather than growers, where you receive the cannabis ready to be consumed. Before this stage the growers must grow and dry the buds without them getting moldy. Large buds, poor air flow and high humidity can cause buds to mold on the plant. Once the plant is grown to maturity, it is chopped down and left to dry.
This takes a few days to a couple weeks to complete and if air circulation isn’t adequate, mold can start to grow. The buds still have extra moisture in the center that disperses when in a jar or baggie. This is something to watch out for as a consumer. The bud will feel and look fine but if you rip the bud open you will feel the moisture. If this bud is left sealed up for a few days it can/will go moldy.
This is the main thing to watch out for as a cannabis consumer. If the bud feels too moist to you, check on it everyday and if it’s too moist lay the cannabis out to dry for 10-20 mins then reseal until the next day. Do this until when you check on the bud it doesn’t feel moist, then check every few days. This will help ensure it doesn’t get moldy.