Finally found it oml. It was because I forgot to reset the dictionary that kept track of the enemies, and so when a previously battled battle had more enemies than the current battle, it tried to switch to an enemy that wasn't there. So it was just a coincidence that it happened exactly on the executioner miniboss for both of us.
Anyways, thanks for reporting the bug :D