Sorry for the long response. Life happens, y'know.
I'm afraid I didn't quite have enough info to repro this, but I had a hunch what was causing it between looking at Yanfly's code and my own. As such, I have a possible fix, but I can't 100% guarantee this one. (Actually, if I'm right, the error isn't far off from what caused the last one.)