Abu Huraira رضي الله عنه narrates: The Messenger of Allah (ﷺ) said:
"If anyone is fasting and eats or drinks forgetfully, then he should complete his fast (as his fast is valid), and whatever he has eaten or drunk, has been granted to him by Allah(swt)."
(Bukhari 1933)