The Prophet of Allah ﷺ said, "One of the prophets was bitten by an ant, so he ordered that the ants' colony be burned, and it was burned. Then Allah revealed to him, 'Because a single ant bit you, you have destroyed a whole community that glorified Me.'"Muhammad bin Yahya reported to us that Abu Salih told them that Layth related to him from Yunus, from Ibn Shihab, with his chain of transmission, a similar account, except that he said "bit" in the feminine form.
حدثنا أحمد بن عمرو بن السرح وأحمد بن عيسى المصريان قالا حدثنا عبد الله بن وهب أخبرني يونس عن ابن شهاب عن سعيد بن المسيب وأبي سلمة بن عبد الرحمن
عن نبي الله ﷺ قال إن نبيا من الأنبياء قرصته نملة فأمر بقرية النمل فأحرقت فأوحى الله عز وجل إليه في أن قرصتك نملة أهلكت أمة من الأمم تسبح حدثنا محمد بن يحيى حدثنا أبو صالح حدثني الليث عن يونس عن ابن شهاب بإسناده نحوه وقال قرصت
Bukhari transmitted it in the Book of Jihad and Expeditions, chapter 153, hadith 3019, and Muslim in the Book of Greetings, chapter on the prohibition of killing ants, hadith 148/2241, from Ibn Sarh with this chain, from the hadith of Yunus with this chain.