MZ Battle bug: cannot read property 'id' of null

This happens after a skill is cast on an enemy.
Strangely it seems to be only on this specific enemy, and the enemy has nothing special, nothing that differentiates it from the other ones.

Any clue what might be happening and how to fix it?

bug1.png


bug2.png
The key to the error is that "of NULL".

it basically means that the engine tries to access a data object that does not exist, usually due to a reference pointing to an entry that has been deleted (database problem) or was never made (plugin configuration).

from the context I would check that specific enemy and its notetags for possible errors, or the troop that that enemy is in for references to other (now deleted) enemies.

for testing purposes, I suggest making a new troop with only that enemy one once and try to fight that in an ingame evented battle. If that works the error is likely in the troops (deleted other enemy or so), if that also fails the error is likely in the enemy data (wrong notetag or so)

it might be in the plugin configuration of one of the two plugins involved, but that is unlikely
The error stack is showing a bunch of obfuscated VS functions. I'd say something in your note tags on the skill, or in the action sequence, is trying to get the id of the target, and it doesn't exist. Or perhaps some state it has is running a <before eval> or something with some bad code in it.

If it only happens to this one enemy, the best thing to do is first to remake the troop from scratch, and if it still happens, delete and remake the enemy, and then remake the troop again.
I think I've found the problem.
With TPB Wait there is a softlock happening if the enemy has extra action (in this case it was one Action Times +100%).
I know that softlock was fixed with CPB so I switched to it and indeed it seemed that this fixed the glitch. I haven't ran a lot of tests yet to be 100% sure, but I was getting the glitch all the time before that change, so it very likely did it.

Original thread: https://forums.rpgmakerweb.com/threads/battle-bug-cannot-read-property-id-of-null.148026/