Hi Sabrina! So sorry for my late response! Humidity is one of the main causes for mold. I.e. when the chilis are not dry enough before being placed in the jar. Besides that, I recommend not storing them for too long (=several months) in general.
Greetings :)