I _do_ want to phone in on the whole duplicate key issue.
Sure, this could be a race condition. It could be bad programming. It could be a variety of things.
You ABSOLUTELY do not want to ignore that. Ignoring and moving on will cause consistency problems. Catch it and add it to a log or an email. Continue.
Do NOT silently ignore something trying to add a duplicate key.