Body: <p>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.</p>
  <p>DB Error: constraint violation</p>
  <p>message. The full message is:</p>
  <p>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 (<code>vlaanderen_wordpress</code>.<code>civicrm_group_contact</code>, CONSTRAINT
  <code>FK_civicrm_group_contact_group_id</code> FOREIGN KEY (<code>group_id</code>) REFERENCES <code>civicrm_group</code>
  (<code>id</code>) ON DELETE CASCADE)]</p>
  <p>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</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-22T22:09:38.323Z
Comments.Text: 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.
Comments.UserDisplayName: Parvez Saleh
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-24T12:03:42.637Z
Comments.Text: It is solved now by civihosting. They added direct in the database a group and now it works again.
Comments.UserDisplayName: Francis Bruyninckx
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-26T21:22:58.420Z
Comments.Text: Would you be so kind to self-answer your question. It helps others to find the answer
Comments.UserDisplayName: nielo
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-28T05:21:00.680Z
Comments.Text: Well read my answer direct above your question
Comments.UserDisplayName: Francis Bruyninckx
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-29T00:16:51.913Z
Comments.Text: 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 :-).
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-29T00:17:42.257Z
Comments.Text: you also get brownie points for an A - which will add to your reputation and perhaps help you then participate in SE with fewer constraints
Comments.UserDisplayName: petednz - fuzion
Tags: <wordpress>
Title: After deleteing a group, adding contacts fails with DB constraint error
ThreadText: # After deleteing a group, adding contacts fails with DB constraint error
  
  (Asked by: username_0 on 2020-07-22)
  
  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
  
  **Tags:** wordpress
  
  > **Comments:**
  > **username_1**: 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.  
  > **username_0**: It is solved now by civihosting. They added direct in the database a group and now it works again.  
  > **username_2**: Would you be so kind to self-answer your question. It helps others to find the answer  
  > **username_0**: Well read my answer direct above your question  
  > **username_3**: 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 :-).  
  > **username_3**: you also get brownie points for an A - which will add to your reputation and perhaps help you then participate in SE with fewer constraints  
  
  ---
  
  ## 0 answers
  
  