constraint violation during event registration
If your hook relies on $objectRef being populated, check whether it actually is - they aren't always. See Should civicrm_post hook receive populated Relationship object following relationship enable/disable in UI?