The Prophet ﷺ said, "If somebody eats something forgetfully while he is fasting, then he should complete his fast, for Allah has made him eat and drink."
قَالَ النَّبِيُّ ﷺ مَنْ أَكَلَ نَاسِيًا وَهْوَ صَائِمٌ فَلْيُتِمَّ صَوْمَهُ فَإِنَّمَا أَطْعَمَهُ اللَّهُ وَسَقَاهُ