Narrated Abuz Zinad: When the Messenger of Allah ﷺ cut off (the hands and feet of) those who had stolen his camels and he had their eyes put out by fire (heated nails), Allah reprimanded him on that (action), and Allah, the Exalted, revealed: "The punishment of those who wage war against Allah and His Messenger and strive with might and main for mischief through the land is execution or crucifixion. "
Hadith Referenceسنن ابي داود / كتاب الحدود / 4370
Hadith Gradingالألبانی:ضعيف | زبیر علی زئی:ضعيف, إسناده ضعيف, نسائي (4047), السند مرسل وابن عجلان عنعن, انوار الصحيفه، صفحه نمبر 155
´It was narrated from Abu Az-Zinad that:` The Messenger of Allah [SAW] had the (hands and feet) of those who drove off his camels cut off, and their eyes gouged out with fire. Allah rebuked him for that, and Allah, Most High, revealed the entire verse: "The recompense of those who wage war against Allah and His Messenger."
Hafiz Muhammad Ameen
This narration is weak. This verse was not revealed by Allah Ta'ala to express displeasure towards the Messenger of Allah (sallallahu alayhi wa sallam); rather, what is correct is what has been mentioned in other narrations: that the Messenger of Allah (sallallahu alayhi wa sallam) gouged out their eyes because they had treated the shepherd of the Messenger of Allah (sallallahu alayhi wa sallam) in that manner, so the same treatment was meted out to them in retribution (qisas). And Allah knows best.
Source: Sunan Nasa'i: Translation and Benefits by Shaykh Hafiz Muhammad Amin Hafizullah, Page: 4047