I was using Experiment Balls. When the catch was successful, the pokedex didn't update and the number of balls didn't go down. But switching to using great balls worked. Apologies if Experiment Balls being buggy is a know thing.
I got the following error twice trying to catch Dhelmise:
---------------------------
Pokemon This Gym of Mine
---------------------------
[Pokémon Essentials version 18.1.dev]
Exception: NoMethodError
Message: undefined method `[]' for nil:NilClass
Backtrace:
PokeBall_CatchEffects:258...