Answers.Body: <p>So in the DB itself the table &quot;civicrm_uf_match&quot;, the &quot;id&quot; &amp; &quot;uf_id&quot; contained different numbers</p>
  <p>Example:
  id = 3
  uf_id = 7</p>
  <p>I matched the numbers to be the same and have fixed the issue.</p>
  <p>@demerit thanks for the info too.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-06T19:11:05.433Z
Answers.LastActivityDate: 2024-03-06T19:11:05.433Z
Answers.UserDisplayName: Juggy69
Answers.Body: <p>Change <a href="https://github.com/civicrm/civicrm-core/blob/a63136245d54415ecf451256f72e1cdfb0dfa196/api/v3/Contact.php#L649" rel="nofollow noreferrer">this line</a> in api/v3/Contact.php line 649 from</p>
  <p><code>throw new CRM_Core_Exception(ts('Invalid %1 greeting', [1 =&gt; $key]));</code></p>
  <p>to</p>
  <p><code>throw new CRM_Core_Exception(ts('Invalid %1 greeting: %2', [1 =&gt; $key, 2 =&gt; $greetingVal]) . ' ' . var_export($params, true));</code></p>
  <p>This will give you some extra debugging info, and the <code>contact_id</code> value in the output will tell you which contact is the problem.</p>
  <p>It seems like $greetingVal is somehow not one of the defined greetings.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-04T20:51:08.983Z
Answers.Text: Thanks for the info, i tried this but as soon as I tried to load CiviCRM within WordPress, I got the error WordPress Critical Error screen
  
  I should also elaborate, I can for example export individually the first 6 contacts in the contact search, but if I try to export all 3 or more contacts I get the error above, I can export the 1 or 2 contacts at a time.
Answers.UserDisplayName: Juggy69
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-05T20:43:27.410Z
Answers.Text: I understand but the above will tell you what is happening with $greetingVal which may give more clues. What was the critical error - maybe a copy/paste typo?
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-05T23:17:48.287Z
Answers.Text: So the problem seems to be that at the time this gets called greetingVal is the number 1 instead of the actual value, and postal_greeting_id is null. But related to your last point, it's strange that this function is even being called, since it gets called during contact creation. So it seems something is creating a duplicate of your contact during export???
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-04T17:55:07.230Z
Answers.LastActivityDate: 2024-03-04T17:55:07.230Z
Answers.UserDisplayName: Demerit
Body: <p>When I try to export multiple contacts I get the following error, if i do them one at a time no issue but I have nearly 24000 contacts</p>
  <p>WordPress version 6.4.3
  Active theme: Twenty Twenty-One Child (version 1.4.1643122669)
  Current plugin: CiviCRM (version 5.57.1)
  PHP version 7.4.27</p>
  <h1>Error Details</h1>
  <p>An error of type E_ERROR was caused in line 135 of the file wp-content/plugins/civicrm/civicrm/api/api.php. Error message: Uncaught CRM_Core_Exception: [0: Invalid postal greeting</p>
  <p>thrown</p>
  <p>I have checked the postal greeting but cannot see anything that would cause it</p>
  <p>Any ideas?</p>
  
Tags: <contacts><export>
Title: Contact Export Failure on Multiple Contacts
ThreadText: # Contact Export Failure on Multiple Contacts
  
  (Asked by: username_0 on 2024-03-04)
  
  When I try to export multiple contacts I get the following error, if i do them one at a time no issue but I have nearly 24000 contacts
  
  WordPress version 6.4.3
  Active theme: Twenty Twenty-One Child (version 1.4.1643122669)
  Current plugin: CiviCRM (version 5.57.1)
  PHP version 7.4.27
  
  # Error Details
  
  An error of type E\_ERROR was caused in line 135 of the file wp-content/plugins/civicrm/civicrm/api/api.php. Error message: Uncaught CRM\_Core\_Exception: [0: Invalid postal greeting
  
  thrown
  
  I have checked the postal greeting but cannot see anything that would cause it
  
  Any ideas?
  
  **Tags:** contacts, export
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2024-03-06. Score: 1
  
  So in the DB itself the table "civicrm\_uf\_match", the "id" & "uf\_id" contained different numbers
  
  Example:
  id = 3
  uf\_id = 7
  
  I matched the numbers to be the same and have fixed the issue.
  
  @demerit thanks for the info too.
  
  
  ---
  
  ### Answer by username_1 on 2024-03-04. Score: 0
  
  Change [this line](https://github.com/civicrm/civicrm-core/blob/a63136245d54415ecf451256f72e1cdfb0dfa196/api/v3/Contact.php#L649) in api/v3/Contact.php line 649 from
  
  `throw new CRM_Core_Exception(ts('Invalid %1 greeting', [1 => $key]));`
  
  to
  
  `throw new CRM_Core_Exception(ts('Invalid %1 greeting: %2', [1 => $key, 2 => $greetingVal]) . ' ' . var_export($params, true));`
  
  This will give you some extra debugging info, and the `contact_id` value in the output will tell you which contact is the problem.
  
  It seems like $greetingVal is somehow not one of the defined greetings.
  
  > **Comments:**
  > **username_0**: Thanks for the info, i tried this but as soon as I tried to load CiviCRM within WordPress, I got the error WordPress Critical Error screen  I should also elaborate, I can for example export individually the first 6 contacts in the contact search, but if I try to export all 3 or more contacts I get the error above, I can export the 1 or 2 contacts at a time.  
  > **username_1**: I understand but the above will tell you what is happening with $greetingVal which may give more clues. What was the critical error - maybe a copy/paste typo?  
  > **username_1**: So the problem seems to be that at the time this gets called greetingVal is the number 1 instead of the actual value, and postal_greeting_id is null. But related to your last point, it's strange that this function is even being called, since it gets called during contact creation. So it seems something is creating a duplicate of your contact during export???  
  
  ---
  
  