Answer: Rambam (Shabbos 12:9; 13:5) writes that in order to transgress the melacha mideoraisa of hotza’a, carrying on Shabbos, one needs to have picked an item up (akirah), carried it into another reshus (domain) or at least four amos in a reshus harabim (hiluch) and have put it back down again (hanacha). If one finds oneself inadvertently carrying on Shabbos, one should try one’s utmost to eliminate one of these stages in order to minimize the prohibition.
An area enclosed by an eruv is considered a reshus hayachid while most streets and parks would be a carmelis. Carrying from one to the other is assur miderabanan (See Shabbos 6a; Shulchan Aruch OC 346:1).
Rambam (Shabbos 13:8) writes that if one stops walking, it is considered to be hanacha. Thus, one who accidentally carried something to another domain and immediately brought it back without stopping would not have transgressed the melacha of hotza’a. The Shulchan Aruch (OC 266:11) writes that in such a scenario one should run which will remind them not to stop.
In the event that one had stopped walking since one walked outside, they must not carry it back inside as they are considered to have done hanacha there. In this case, it would be best to place it down on a makom petur, an object that is at least three tefachim high, though is less than four tefachim by four tefachim across (See Rema OC 345:18). Failing that, one should allow the item to drop with a shinui such as by throwing it over one’s shoulder.
In conclusion, one who accidentally carried something out the eruv into a carmelis should hurry back to where they came from. If they had stopped walking since entering the carmelis, they should find a small place to put it on or allow the item to fall to the ground with a shinui while walking.