Check for line in table planingelement where refType='Milestone' and refId=id of the milestone.
If line exist (and milestone does not), delete line.
But is may be important to understand what happened.
For intance, check report "history" for this milestone...
ok, I checked:
table milestone: the milestone was not found
table: planningelement: milestone found
--> deleted and planning is fine now
Nevertheless the history is not very interesting:
Only inserted and then immediatley deleted
Maybe the script was interrupted on the server?
But thank you 🙂