‘Imran b. Husain reported God's Messenger as saying, “A vow to do an act of disobedience must not be fulfilled, or one to do something over which one has no control.”
Muslim transmitted it. A version has, “No vow must be taken to disobey God.”
While the Prophet was preaching a man was standing, so he asked about him and was told that he was Abu Isra’il who had taken a vow to stand and not to sit, or go into the shade, or speak, but to fast. Thereupon the Prophet said, “Command him to speak, go into the shade, sit and complete his fast.”