Happened also to me, after i gave the battle up, i reloaded a previous save (i saved just before the battle) and went into the exactly same error with the same units trapped outside in the same skirmish.