The Prophet ﷺ said, "One of the prophets stopped to rest under a tree, and an ant bit him. He ordered his belongings to be removed from beneath it, then commanded that the tree be burned. Allah revealed to him, 'Why not just a single ant?'"
حدثنا قتيبة بن سعيد عن المغيرة يعني ابن عبد الرحمن عن أبي الزناد عن الأعرج
أن النبي ﷺ قال نزل نبي من الأنبياء تحت شجرة فلدغته نملة فأمر بجهازه فأخرج من تحتها ثم أمر بها فأحرقت فأوحى الله إليه فهلا نملة واحدة
Graded by Muslim, chapter on the prohibition of killing ants, no. 2241, from Qutayba, with this wording. Bukhari, chapter on the beginning of creation, chapter on when a fly falls into the drink of one of you... regarding the sanctuary, no. 3319, from the hadith of Abu Zinad, with this wording.