The Messenger of Allah ﷺ said, "Abdul-Rahman, do not ask for a position of authority. If it is given to you because you asked for it, you will be left to handle it on your own. But if it is given to you without your asking, you will be helped in carrying it out. And if you take an oath and then see that something else is better, do that which is better and make expiation for your oath."
حدثنا محمد بن عبد الأعلى الصنعاني حدثنا المعتمر بن سليمان عن يونس هو ابن عبيد حدثنا الحسن
قال رسول الله ﷺ يا عبد الرحمن لا تسأل الإمارة فإنك إن أتتك عن مسألة وكلت إليها وإن أتتك عن غير مسألة أعنت عليها وإذا حلفت على يمين فرأيت غيرها خيرا منها فأت الذي هو خير ولتكفر عن يمينك
Agreed upon. Bukhari narrated it in the Book of Rulings, chapter on one who asks for authority and is entrusted with it, hadith no. 7147, and Muslim, hadith no. 1652, from the hadith of Yunus bin Ubayd, with this wording.On this subject there are also narrations from Ali [the reference points to the hadith of Ahmad, 1/90, and Allah knows best], Jabir [Tabarani in Al-Awsat, 5/246, hadith no. 4485], Adi bin Hatim [Muslim, hadith no. 1651], Abu Darda [Hakim, 4/301, and Bayhaqi, 10/52], Anas [coming up, 1536, 1537], Ayesha [Ibn Majah, hadith no. 2110], Abdullah bin Amr [Abu Dawud, hadith no. 3274], Abu Hurairah [Al-Kabir, 23/307, hadith no. 694], Abu Musa [Bukhari, coming up, 1530], and Umm Salama [Tabarani in Al-Kabir, 23/307, hadith no. 3133, and Muslim, hadith no. 1649].