Ali bin Abu Talib reported,

The Messenger of Allah ﷺ sent out a military expedition and placed a man from the Ansar in command of them. When they had set out, he became angry with them over something and said to them, "Has not the Messenger of Allah ﷺ commanded you to obey me?"They replied, "Yes."He said, "Gather firewood." Then he called for fire and set the wood ablaze. Then he said, "I order you to enter it."The men were about to enter it when a young man among them said, "You only fled to the Messenger of Allah ﷺ to escape the fire, so do not be hasty until you meet the Prophet ﷺ. If he commands you to enter it, then enter."So they returned to the Prophet ﷺ and informed him of what had happened. He said to them, "Had you entered it, you would never have come out of it. Obedience is only in what is right."

Ahmad 622

Sahih

حدثنا أبو معاوية حدثنا الأعمش عن سعد بن عبيدة عن أبي عبد الرحمن السلمي

عن علي رضي الله عنه قال

بعث رسول الله ﷺ سرية واستعمل عليهم رجلا من الأنصار قال فلما خرجوا قال وجد عليهم في شيء فقال قال لهم أليس قد أمركم رسول الله ﷺ أن تطيعوني قال قالوا بلى قال فقال اجمعوا حطبا ثم دعا بنار فأضرمها فيه ثم قال عزمت عليكم لتدخلنها قال فهم القوم أن يدخلوها قال فقال لهم شاب منهم إنما فررتم إلى رسول الله ﷺ من النار فلا تعجلوا حتى تلقوا النبي ﷺ فإن أمركم أن تدخلوها فادخلوا قال فرجعوا إلى النبي ﷺ فأخبروه فقال لهم لو دخلتموها ما خرجتم منها أبدا إنما الطاعة في المعروف

أحمد 622صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Ali bin Abu Talib
Numbering
Darussalam 622
Ahmad 622