Cleanup inactive user fails

I’m also getting this error:

Job exception: PG::DatatypeMismatch: ERROR:  argument of AND must be type boolean, not type record
LINE 1: ...CT "user_histories".* FROM "user_histories" WHERE (acting_us...
                                                             ^

From what it looks like, there is no data for that specific acting_user_id in the user_histories table.

The error is also triggered by trying to manually delete the user.