Thank you so much for this. I had this issue developing over time. I could mitigate it by falling back on older versions.
I know I have a legacy server where a couple packages are in this state, I was just hoping I would never have to change nothing to these packages since they are legacy.
Your solution is a real life saver.
In my case I guess the problem was somewhat caused by using a third party monitoring and notification application and somehow sometimes, the code got lost in the continuum.
Very rarely but still when it happens, you end-up with a package you cannot trust anymore and it is always a package you really do not want to rewrite from scratch.