Workflow error

I’m trying to run a Workflow function that sends an email when a case’s status is changed. The modules are all custom except Users. The Workflow is not firing, and this error is showing up repeatedly in the log:

Thu Oct 8 14:24:03 2015 [12858][1][FATAL] Query Failed: FROM cdata_assignments WHERE NOT EXISTS (SELECT * FROM aow_processed WHERE aow_processed.aow_workflow_id=‘1e9d0647-042d-ed41-1cae-556783e1d63a’ AND aow_processed.parent_id=cdata_assignments.id AND aow_processed.status = ‘Complete’ AND aow_processed.deleted = 0) AND cdata_assignments.deleted = 0 : MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘FROM cdata_assignments WHERE NOT EXISTS (SELECT * FROM aow_processed WHERE aow_’ at line 1

Anyone have any suggestions?

Update: I’m not sure which of the many things I tried did it, but the error is now this:

Thu 08 Oct 2015 04:35:56 PM EDT [15279][1][FATAL] Query Failed: INSERT INTO tracker (monitor_id,user_id,module_name,item_id,item_summary,date_modified,action,session_id,visible ) VALUES ( ‘c30f9229-b4fc-e56b-c787-5616d39ca921’,‘1’,‘AOW_WorkFlow’,‘1e9d0647-042d-ed41-1cae-556783e1d63a’,‘Test’,‘2015-10-08 20:35:56’,‘detailview’,‘23qkdnltshq0tubkujc38nacl4’,‘1’): MySQL error 1062: Duplicate entry ‘0’ for key ‘PRIMARY’

By the way, the process AOW scheduled task is running every minute and seems to be functioning properly. I’m on 7.3.1, running on an Xubuntu server.

I know I’m only replying to myself here, but maybe this will help someone else down the line. It looks like there are two separate problems. The one with the MySQL syntax is solved by changing line 169 in /modules/AOW_WorkFlow/AOW_WorkFlow.php like so:

$query .= ’ FROM ’ .$module->table_name.’ ';

Should be:

$query .= ‘SELECT * FROM ’ .$module->table_name.’ ';

Still working on the second problem, which appears to be related to creating unique IDs when adding records to the tracker table.

Whoops. Ignore the above “fix.” It appeared to work for a while, but it’s no good.