Hacham Ovadia Yosef, in his work Hazon Ovadia (vol. 4, p. 425), addresses the case of a woman who, late Friday afternoon, places a raw egg in a pot over the fire, not realizing that the sun had already set. May the egg be eaten on Shabbat?
The 13.5-minute period immediately after sundown is known as “Ben Ha’shemashot,” and it is uncertain whether this period should be regarded Halachically as day or night. On Friday afternoon, we treat the period of Ben Ha’shemashot as nighttime, as though Shabbat had already begun, as we are uncertain of its status. The question thus becomes as to whether the egg is permissible for consumption on Shabbat, as it was cooked in forbidden fashion. Halacha forbids deriving benefit from food cooked on Shabbat, and thus, seemingly, it would be forbidden to eat an egg – or any food – that was cooked during the period of Ben Ha’shemashot on Friday afternoon.
In truth, however, it is permissible to eat food cooked during this period on Friday afternoon, due to the famous Halachic principle of “Safek De’rabbanan Le’hakel” – we may be lenient in situations of doubt regarding a law enacted by the Sages. Although cooking on Shabbat is clearly forbidden on the level of Torah law, the prohibition against eating food cooked in violation of Shabbat originates from the Sages, as a penalty for violating Shabbat. In the case of food cooked on Ben Ha’shemashot, it is uncertain whether it is considered to have been cooked on Shabbat, as it is uncertain whether this period should be considered Shabbat or Ereb Shabbat. As such, the status of this food is subject to doubt, and we may therefore act leniently, since we deal with a potential Issur De’rabbanan – a law enacted by the Sages, as opposed to Torah law. Hence, if one mistakenly cooked food during the period of Ben Ha’shemashot on Friday afternoon, it is nevertheless permissible for consumption.
Another application of this rule is a case where one turned on a light in an otherwise dark room during Ben Ha’shemashot, not realizing that the sun had already set. Although it is generally forbidden to derive benefit from a light that was turned on in violation of Shabbat, one may derive benefit from a light that was turned on during Ben Ha’shemashot on Friday afternoon, due to the rule of “Safek De’rabbanan Le’hakel.”
Summary: It is forbidden to cook from sundown on Friday afternoon, but if one mistakenly cooked food within 13.5 minutes after sundown, the food is permissible for consumption. Food that was cooked after 13.5 minutes may not be eaten.