Just downloaded this game, and I had the same error when a Voltorb used Sonic Boom in my gym.
---------------------------
Pokemon This Gym of Mine
---------------------------
[Pokémon Essentials version 18.1.dev]
Exception: SystemStackError
Message: stack level too deep
Backtrace...