The Messenger of Allah ﷺ said, "Whoever eats or drinks while forgetting his fast does not break it, for it is merely sustenance that Allah has provided for him."
حدثنا أبو سعيد الأشج حدثنا أبو خالد الأحمر عن حجاج بن أرطاة عن قتادة عن ابن سيرين
قال رسول الله ﷺ من أكل أو شرب ناسيا فلا يفطر فإنما هو رزق رزقه الله
[Sahih] It is agreed upon (by Bukhari and Muslim). Bukhari narrated it in the Book of Fasting, chapter on the fasting person who eats or drinks forgetfully, hadith no. 1933, and Muslim narrated it in the Book of Fasting, chapter on the one who forgetfully eats, drinks, or has intercourse does not break his fast, hadith no. 1155, from the hadith of Muhammad bin Sirin, with this chain.