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


I have checked the postal greeting but cannot see anything that would cause it

Any ideas?

2 Answers 2


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.


Change this line in api/v3/Contact.php line 649 from

throw new CRM_Core_Exception(ts('Invalid %1 greeting', [1 => $key]));


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.

  • 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.
    – Juggy69
    Commented Mar 4 at 20:51
  • 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?
    – Demerit
    Commented Mar 5 at 20:43
  • 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???
    – Demerit
    Commented Mar 5 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.