To be fair, this is why you never ever ever send carriers anywhere without a destroyer. The same problem happens if you send a carrier plus fighters to attack submarines. Since the carrier doesn’t roll attack dice and the fighters can’t hit the submarines, you just have infinite rounds of combat until the subs either sink the carrier or the units retreat.
This is also why it is recommend that when playing the pacific side as either Japan or the US, you purchase at least one sub for every carrier that the other side purchases.
You should also never tip your carriers on defense if you have no where for your planes to land, since the attacker will almost always retreat and watch your planes crash into the ocean for free.