قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ : " نَزَلَ نَبِيٌّ مِنَ الأَنْبِيَاءِ تَحْتَ شَجَرَةٍ فَلَدَغَتْهُ نَمْلَةٌ، فَأَمَرَ بِجَهَازِهِ فَأُخْرِجَ مِنْ تَحْتِهَا، فَأَمَرَ بِهَا فَأُحْرِقَتْ فِي النَّارِ، فَأَوْحَى اللَّهُ إِلَيْهِ : فَهَلا نَمْلَةً وَاحِدَةً "
And the Messenger of Allah, peace and blessings be upon him, said: "One of the prophets among the prophets stopped under the shade of a tree, where an ant bit him, so he ordered that all his belongings be moved from under the tree, then he had the ants burned with fire. Upon this, Allah the Exalted revealed to him that only one ant had bitten you, so you should have burned only that one."
Related hadith on this topic