When someone registers for an event, it now registers them but crashes on to an error page, stating that "source_contact_id is not a valid integer".

I think this has been happening since Civi 5.0.1

I am using Civi 5.0.2 and Drupal 7.59

The Fatal Error Page from the error log is very long, but here's the first bit:

$Fatal Error Details = array(3) { ["message"]=> string(40) "source_contact_id is not a valid integer" ["code"]=> NULL ["exception"]=> object(CiviCRM_API3_Exception)#420 (8) { ["extraParams":"CiviCRM_API3_Exception":private]=> array(3) { ["is_error"]=> int(1) ["error_message"]=> string(40) "source_contact_id is not a valid integer" ["error_code"]=> string(9) "undefined" } ["message":protected]=> string(40) "source_contact_id is not a valid integer" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(88)

Anyone else having this problem or have any ideas?

  • One way of getting this type of question answered is to replicate the problem on dmaster.demo.civicrm.org - assuming that there isn't something about the set up that is beyond the features that 'demo' user has access to.
    – petednz - fuzion
    Apr 26, 2018 at 19:23
  • Thanks for the tip, petednz. The demo site doesn't give the same error, but that might be because it's on 5.2.alpha or because outbound email is disabled. This error I've described is failing to send out confirmatory emails, so that might be part of it Apr 27, 2018 at 9:53
  • True - but demo can be set to 'send to database' which should mimic that process. also "source_contact_id is not a valid integer" does not sound related to an email process. It sounds like it is complaining about the value being submitted
    – petednz - fuzion
    Apr 27, 2018 at 20:30
  • Did you see this? I don't know if it is related if you are not using civirules: github.com/CiviCooP/org.civicoop.civirules/issues/152
    – petednz - fuzion
    Apr 27, 2018 at 20:32

2 Answers 2


The two versions Stuart mentions are different extensions.

https://civicrm.org/extensions/sparkpost-civicrm-integration is the PESC extension from https://github.com/proexchange/com.pesc.sparkpost and the replacement used by Stuart is the Cividesk extension.

I had the same problem experienced by Stuart with the PESC version on a D6 system running CiviCRM 5.0.0. I seem to have fixed it using Stuart's sleuthing - I simply edited the sparkpost.php file and replaced source_record_id with source_contact_id

Everything seems to now work. (I'll report back if I find other problems).

UPDATE: The latest version 1.3.7 of com.pesc.sparkpost fixes the problem.


I think I've found the problem, which is to do with mailing and not primarily events. I had upgraded to what I thought was the latest version (v1.3.5) of the Sparkpost extension, which does all the emails for my installation of Civi. (see https://civicrm.org/extensions/sparkpost-civicrm-integration)

However, it seems that there is a bug in the main sparkpost.php file which has source_record_id instead of source_contact_id. So I think the error was caused because source_contact_id was being left undefined.

Anyway, I've now found a more up to date master version of this extension on Github (although it's called v1.1), and I've installed that and it's working fine so far. :-) https://github.com/cividesk/com.cividesk.email.sparkpost

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.