Abdullah bin Abbas reported,

Two men brought a dispute before the Prophet ﷺ. The Prophet ﷺ asked the claimant for evidence, but he had none, so the defendant was required to take an oath. He swore, "By Allah, beside whom there is no god."The Messenger of Allah ﷺ then said, "Indeed, you did do it, but you have been forgiven because of your sincere declaration that there is no god but Allah."Abu Dawud said, what is meant by this hadith is that he did not command him to make any expiation.

Azami 7139

Sahih

عن عبد الله بن عباس

أن رجلين اختصما إلى النبي ﷺ فسأل النبي ﷺ الطالب البينة. فلم تكن له بينة. فاستحلف المطلوب. فحلف بالله الذي لا إله إلا هو. فقال رسول الله ﷺ: بلى قد فعلت، ولكن قد غفر لك بإخلاص قول لا إله إلا الله قال أبو داود: يراد من هذا الحديث أنه لم يأمره بالكفارة.

الأعظمي 7139صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Oaths and vows
Chapter
Vows
Section
No fulfillment of a vow in disobedience
Numbering
Jami al-Kamil 7139 (2nd edition)
Azami 7139