Cancel Event not completing - MariaDB error in SQL syntax date_added

I am using Mautic 3.2.1
My PHP version is : 7.3.27
My Database type and version is: MariaDB version 10.3.24-MariaDB-cll-lve

My problem is:
When I go into a Contact’s History tab and try to cancel a future Campaign event, it gives a popup saying “This event was scheduled for DATE but has been cancelled.” But when I refresh the page, it is still scheduled.

This is a sample error from the log:

[2021-03-19 05:35:01] mautic.ERROR: CAMPAIGN: An exception occurred while executing ‘REPLACE INTO maut2_campaign_lead_event_failed_log( log_id, date_added, reason) SELECT id, :dateAdded as date_added, :message as reason from maut2_campaign_lead_event_log WHERE is_scheduled = 1 AND lead_id = :contactId AND campaign_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date_added, :message as reason from maut2_campaign_lead_event_l…’ at line 2

I have tried searching on this forum and google, but I am not understanding how to fix the problem.

I need more assistance in how I need to correct the issue. I do not understand what I need to do to fix the SQL syntax error.

Can someone provide me more detailed steps of what I need to do to correct the problem?

Thank you in advance.

run mautic:campaigns:update

@EJL thank you for your reply.

When I run the command in SSH this is the output on the screen:

/usr/local/bin/php bin/console mautic:campaigns:update

Rebuilding contacts for campaign 1
0 total contact(s) to be added in batches of 300
3 total contact(s) to be removed in batches of 300
1/3 [=========>------------------] 33%

and then it goes back to the # line

I do have the cron job set up to do the campaigns updates

    5,20,35,50	*	*	*	*	/usr/local/bin/php /home/NAME/public_html/DOMAINDIRECTORY/bin/console mautic:campaigns:update >/dev/null 2>&1

I am seeing the same error in the logs when I run the command manually as gets output every time the mautic:campaigns:update command gets run (at 5, 20, 35, 50 minutes):

[2021-03-20 17:35:03] mautic.ERROR: CAMPAIGN: An exception occurred while executing ‘REPLACE INTO maut2_campaign_lead_event_failed_log( log_id, date_added, reason) SELECT id, :dateAdded as date_added, :message as reason from maut2_campaign_lead_event_log WHERE is_scheduled = 1 AND lead_id = :contactId AND campaign_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date_added, :message as reason from maut2_campaign_lead_event_l…’ at line 2
[2021-03-20 17:41:06] mautic.ERROR: CAMPAIGN: An exception occurred while executing ‘REPLACE INTO maut2_campaign_lead_event_failed_log( log_id, date_added, reason) SELECT id, :dateAdded as date_added, :message as reason from maut2_campaign_lead_event_log WHERE is_scheduled = 1 AND lead_id = :contactId AND campaign_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date_added, :message as reason from maut2_campaign_lead_event_l…’ at line 2

.

So I am still stuck as to how to fix it.

Can you provide any additional suggestions?

I do not seem to have any errors with the other cron jobs I have set for mautic, because I am not seeing any entries in the log for those commands:

0,15,30,45 * * * * /usr/local/bin/php /home/NAME/public_html/DOMAINDIRECTORY/bin/console mautic:segments:update >/dev/null 2>&1

10,25,40,55 * * * * /usr/local/bin/php /home/NAME/public_html/DOMAINDIRECTORY/bin/console mautic:campaigns:trigger >/dev/null 2>&1

*/15 2 10 * * /usr/local/bin/php /home/NAME/public_html/DOMAINDIRECTORY/bin/console mautic:iplookup:download >/dev/null 2>&1

Worth mentioning that when I bumped up the PHP version that runs the cron job the error went away. For anyone that might stumble on this in the future.