I'm getting an error message on scheduled SMS.

Finished execution of Send Scheduled SMS with result: Failure, Error message: DB Error: syntax error

I'm running 4.7.8 and I think it was stable in 4.7.6. My WP install is 4.5.3

  • Are you able to send an individual SMS without error? What service provider are you using for your SMS? Commented Jun 28, 2016 at 5:27
  • 1
    More details about the DB error should be available in your CiviCRM debug log (instructions to locate). If you find the "DB Error" in that logfile and share the backtrace here, you'll be able to get a more informed answer. Make sure no sensitive data (eg SMS provider login) is included :) Commented Jun 28, 2016 at 9:23
  • Thanks guys, I will get onto that. The provider is Clickatell and the system works when I send on test SMS.
    – PeteRoss
    Commented Jun 29, 2016 at 6:28
  • Finally had a chance to get back to this one. End of financial year is a killer! db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="
    – PeteRoss
    Commented Jul 7, 2016 at 4:11
  • @Chris Burgess How do I load the entire backtrace here? It's a bit long. Thanks!
    – PeteRoss
    Commented Jul 7, 2016 at 4:17

2 Answers 2


This error does show up in Civi 4.7.8 on Drupal 7.x. @PeteRoss Thanks. Haven't had chance to upgrade to 4.7.9 yet.

Had to send scheduled event SMS to members, so modified sql in if statement in CRM/Mailing/BAO/MailingJob.php

525 if ($mailing->sms_provider_id) { .... .... 546 OR contact_a.do_not_sms = 0 ) - 547 $aclWhere}"; + 547 $aclWhere"; 548 }

The scheduled SMS job completed successfully after the modification.


It appears that Civi on WordPress was throwing an extra } into the query from the file Mailingjob.php line 547. I hope this helps someone else and is there some way we can check if this affects others?

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.