It is narrated from Imran bin Husain (may Allah be pleased with him) that the Messenger of Allah (ﷺ) said: "There is no (fulfillment of) vow in disobedience to Allah, nor is it necessary to fulfill a vow regarding that which the son of Adam does not possess."
Hadith Referenceمسند الإمام الشافعي / كتاب النذور / 1045
Hadith Takhrijاخرجه مسلم النذر ، باب لا وفاء لنذر في معصية الله ولا فيما لا يملك العبد (1641)۔