Fungus gnats are probably the most annoying because they can be plentiful immediately after hatching from microscopic eggs that hide in the soil. Since moss has no root system even fungus gnats, which feed on the roots of plants, are not harmful to your moss terrarium.
People also ask, how do I get rid of fungus gnats in my reptile enclosure?
Mix one part 3% hydrogen peroxide with four parts water. Allow the top layer of your soil to dry, and then water your plants with this solution as you normally would. The soil will fizz for a few minutes after application; this is normal. The fungus gnat larvae will die on contact with the hydrogen peroxide.