I have the following problem. I deleted a group and now I cannot add any more contacts. I keep getting this error. How can I solve this.

DB Error: constraint violation

message. The full message is:

REPLACE INTO civicrm_group_contact ( group_id, contact_id, status ) VALUES ( 1, 90, 'Added' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (vlaanderen_wordpress.civicrm_group_contact, CONSTRAINT FK_civicrm_group_contact_group_id FOREIGN KEY (group_id) REFERENCES civicrm_group (id) ON DELETE CASCADE)]

Fatal error: Uncaught CRM_Core_Exception: [0: Transaction integrity error: Expected to find active frame thrown in /home/vlaanderen/www/www/wp-content/plugins/civicrm/civicrm/Civi/Core/Transaction/Manager.php on line 93

  • 3
    How are you adding contacts? Sounds like you have an extension or something that is trying to add to a group when the group doesn't exist as you've described. As an interim measure you could create an entry in civicrm_group with an ID of 1 - that will at least stop the error. Then you would need to establish exactly where the group is being referenced. Jul 22 '20 at 22:09
  • 1
    It is solved now by civihosting. They added direct in the database a group and now it works again. Jul 24 '20 at 12:03
  • 1
    Would you be so kind to self-answer your question. It helps others to find the answer
    – nielo
    Jul 26 '20 at 21:22
  • Well read my answer direct above your question Jul 28 '20 at 5:21
  • Nielo's point is that Stack Exchange is a Q+A system, so the goal is to have at least one A for each Q. Someone else could now paste your comment as an Answer but it would be better for you to do so as you could then Accept the answer. which is kind of the goal of SE :-).
    – petednz - fuzion
    Jul 29 '20 at 0:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.