What do I do if I forget I’m fasting and forgetfully eat something?

To forgetfully eat something does not break the fast, but one should cease immediately when they remember.

Abu Hurayrah reported the Prophet (s) said, “If somebody eats something forgetfully while he is fasting, then he should complete his fast, for Allah has made him eat and drink.” [Sahih Al-Bukhari Hadith 8.662]