The Messenger of Allah ﷺ said, "There is no vow in disobedience, and no vow concerning what the son of Adam does not own."
حدثنا أبو بكر بن أبي سهل حدثنا سفيان بن عيينة حدثنا أيوب عن أبي قلابة عن عمه
قال رسول الله ﷺ لا نذر في معصية ولا نذر فيما لا يملك ابن آدم
Muslim narrated it in the Book of Vows, Chapter "There is no fulfillment of a vow that involves disobedience to Allah, nor in what a person does not own," hadith no. 1641, from the hadith of Ayub, with this wording, at greater length.