Sahih Muslim Book 27, Hadith 39
Messenger of Allah, I had taken a vow during the days of Ignorance (Jahiliyya) that I would observe I'tikaf for a night in the Sacred Mosque. He (the Holy Prophet) said: Fulfil your vow.
This is what Abu Huraira reported to us from Allah's Messenger (ﷺ), and he narrated a hadith and (one) of them is that Allah's Messenger (ﷺ) said: I swear by Allah, it is more sinful in Allah's sight for one of you to persist in an oath regarding his family than payment of its expiation which Allah has imposed upon him (for breaking the oath).
This hadith is transmitted on the authority of Ibn Umar with a slight variation of words.