When using a 2 turn move like fly or dig, if the target dies the turn the damage is supposed to hit, but before damage is actually done, the move fails and all following moves used on the user automatically fail. This bug could most easily be seen in doubles battles and it's happened to me multiple times in a row.
To recreate it, enter a doubles battle, have one side use non damaging moves, the other side use dig, and whatever else. on turn 2, side 1 use non damaging moves again, and the pokemon that is not using dig needs to kill either the target of dig, or both pokemon.
Of course the non-dig pokemon needs to be faster than the dig pokemon