The Messenger of Allah ﷺ said, "When a judge makes a ruling and exercises his judgment correctly, he receives two rewards. When he rules and errs, he receives one reward."
حدثنا الحسين بن مهدي حدثنا عبد الرزاق أخبرنا معمر عن سفيان الثوري عن يحيى بن سعيد عن أبي بكر بن عمرو بن حزم عن أبي سلمة
قال رسول الله ﷺ إذا حكم الحاكم فاجتهد فأصاب فله أجران وإذا حكم فأخطأ فله أجر واحد
[Sahih] Nasai also recorded it: 8/224, no: 5383 (Etiquette of Judgment, Chapter on Getting the Ruling Right) from the hadith of Abdul-Razzaq, and Bukhari, no: 7352, and Muslim, no: 1716, from the hadith of Abu Bakr bin Muhammad, through him.On this subject there is also a report from Amr bin As [Muslim, no: 1716, and Bukhari, no: 7352] and from Uqba bin Amir [Ahmad: 4/205].