Invalid utf8 character string in idvisitor

I’m seeing hundreds of the errors below (three examples) in the mysql slow log. I use redis and the queue is getting excessively long and I think these are causing it. How can I fix it.

I’m currently running version 3.14, PHP v 7.1.33, mySql v * Server version: 5.6.32-78.0-log - Percona Server (GPL), Release 78.0, Revision 8a8e016

error code is 1300 : Invalid utf8 character string

# Time: 200910 16:02:14
# User@Host: XXX_XXXXXX[XXX_XXXXXX] @ localhost [127.0.0.1]  Id: 81847
# Schema: piwik  Last_errno: 1300  Killed: 0
# Query_time: 1.549375  Lock_time: 0.000116  Rows_sent: 1  Rows_examined: 346  Rows_affected: 0
# Bytes_sent: 4236
SET timestamp=1599768134;
SELECT visit_last_action_time, visit_first_action_time, idvisitor, idvisit, user_id, visit_exit_idaction_url, 
visit_exit_idaction_name, visitor_returning, visitor_days_since_first, visitor_days_since_order, 
visitor_count_visits, visit_goal_buyer, location_country, location_region, location_city, location_latitude, 
location_longitude, referer_name, referer_keyword, referer_type, idsite, visit_entry_idaction_url, 
visit_total_actions, visit_total_interactions, visit_total_searches, referer_url, config_device_brand, 
config_device_model, config_device_type, visit_total_events, visit_total_time, location_ip, 
location_browser_lang, custom_var_k1, custom_var_v1, custom_var_k2, custom_var_v2, 
custom_var_k3, custom_var_v3, custom_var_k4, custom_var_v4, custom_var_k5, custom_var_v5   
FROM piwik_log_visit FORCE INDEX (index_idsite_idvisitor)  WHERE idsite = '65' AND 
visit_last_action_time <= '2020-09-10 18:53:45' AND idvisitor = '\n	��1�}'
                ORDER BY visit_last_action_time DESC
                LIMIT 1;
# User@Host: XXX_XXXXXX[XXX_XXXXXX] @ localhost [127.0.0.1]  Id: 81809
# Schema: piwik  Last_errno: 1300  Killed: 0
# Query_time: 2.736474  Lock_time: 0.000107  Rows_sent: 1  Rows_examined: 503  Rows_affected: 0
# Bytes_sent: 4232
SET timestamp=1599768134;
SELECT visit_last_action_time, visit_first_action_time, idvisitor, idvisit, user_id, visit_exit_idaction_url, 
visit_exit_idaction_name, visitor_returning, visitor_days_since_first, visitor_days_since_order, 
visitor_count_visits, visit_goal_buyer, location_country, location_region, location_city, location_latitude, 
location_longitude, referer_name, referer_keyword, referer_type, idsite, visit_entry_idaction_url, 
visit_total_actions, visit_total_interactions, visit_total_searches, referer_url, config_device_brand, 
config_device_model, config_device_type, visit_total_events, visit_total_time, location_ip, 
location_browser_lang, custom_var_k1, custom_var_v1, custom_var_k2, custom_var_v2, 
custom_var_k3, custom_var_v3, custom_var_k4, custom_var_v4, custom_var_k5, custom_var_v5   
FROM piwik_log_visit FORCE INDEX (index_idsite_idvisitor)  WHERE idsite = '47' AND 
visit_last_action_time <= '2020-09-10 19:31:03' AND idvisitor = '�\"��O*zz'
                ORDER BY visit_last_action_time DESC
                LIMIT 1;
# User@Host: XXX_XXXXXX[XXX_XXXXXX] @ localhost [127.0.0.1]  Id: 81888
# Schema: piwik  Last_errno: 1300  Killed: 0
# Query_time: 2.118495  Lock_time: 0.000145  Rows_sent: 1  Rows_examined: 377  Rows_affected: 0
# Bytes_sent: 4392
SET timestamp=1599768134;
SELECT visit_last_action_time, visit_first_action_time, idvisitor, idvisit, user_id, visit_exit_idaction_url, 
visit_exit_idaction_name, visitor_returning, visitor_days_since_first, visitor_days_since_order, 
visitor_count_visits, visit_goal_buyer, location_country, location_region, location_city, location_latitude, 
location_longitude, referer_name, referer_keyword, referer_type, idsite, visit_entry_idaction_url, 
visit_total_actions, visit_total_interactions, visit_total_searches, referer_url, config_device_brand, 
config_device_model, config_device_type, visit_total_events, visit_total_time, location_ip, 
location_browser_lang, custom_var_k1, custom_var_v1, custom_var_k2, custom_var_v2, 
custom_var_k3, custom_var_v3, custom_var_k4, custom_var_v4, custom_var_k5, custom_var_v5   
FROM piwik_log_visit FORCE INDEX (index_idsite_idvisitor)  WHERE idsite = '58' AND 
visit_last_action_time <= '2020-09-10 18:47:02' AND idvisitor = '�2�Ҭ��'

so we moved to a faster server running a newer php version (PHP 7.4.4 (cli) (built: Mar 19 2020 21:07:46) ( NTS )) but I still see that same error (Last_errno: 1300 ). Googling the code it’s for an invalid utf8 character string. It’s always on the same query… any ideas as to the cause?

# Time: 201007  8:51:55
# User@Host: XXXX[XXXXX] @ localhost [127.0.0.1]  Id:  2612
# Schema: piwik  Last_errno: 1300  Killed: 0
# Query_time: 0.629662  Lock_time: 0.000122  Rows_sent: 1  Rows_examined: 856  Rows_affected: 0
# Bytes_sent: 4351
SET timestamp=1602075115;
SELECT visit_last_action_time, visit_first_action_time, idvisitor, idvisit, user_id, visit_exit_idaction_url, visit_exit_idaction_name, visitor_returning, visitor_days_since_first, visitor_days_since_order, visitor_count_visits, visit_goal_buyer, location_country, location_region, location_city, location_latitude, location_longitude, referer_name, referer_keyword, referer_type, idsite, visit_entry_idaction_url, visit_total_actions, visit_total_interactions, visit_total_searches, referer_url, config_device_brand, config_device_model, config_device_type, visit_total_events, visit_total_time, location_ip, location_browser_lang, custom_var_k1, custom_var_v1, custom_var_k2, custom_var_v2, custom_var_k3, custom_var_v3, custom_var_k4, custom_var_v4, custom_var_k5, custom_var_v5   FROM piwik_log_visit FORCE INDEX (index_idsite_idvisitor)  WHERE idsite = '72' AND visit_last_action_time <= '2020-10-07 13:21:50' AND idvisitor = '{2c�TW�['
                ORDER BY visit_last_action_time DESC
                LIMIT 1;
# User@Host: XXXXX[XXXXX] @ localhost [127.0.0.1]  Id:  2564
# Schema: piwik  Last_errno: 1300  Killed: 0
# Query_time: 0.865467  Lock_time: 0.000138  Rows_sent: 1  Rows_examined: 1310  Rows_affected: 0
# Bytes_sent: 4322
SET timestamp=1602075115;
SELECT visit_last_action_time, visit_first_action_time, idvisitor, idvisit, user_id, visit_exit_idaction_url, visit_exit_idaction_name, visitor_returning, visitor_days_since_first, visitor_days_since_order, visitor_count_visits, visit_goal_buyer, location_country, location_region, location_city, location_latitude, location_longitude, referer_name, referer_keyword, referer_type, idsite, visit_entry_idaction_url, visit_total_actions, visit_total_interactions, visit_total_searches, referer_url, config_device_brand, config_device_model, config_device_type, visit_total_events, visit_total_time, location_ip, location_browser_lang, custom_var_k1, custom_var_v1, custom_var_k2, custom_var_v2, custom_var_k3, custom_var_v3, custom_var_k4, custom_var_v4, custom_var_k5, custom_var_v5   FROM piwik_log_visit FORCE INDEX (index_idsite_idvisitor)  WHERE idsite = '60' AND visit_last_action_time <= '2020-10-07 13:21:32' AND idvisitor = '�[��,h�'
                ORDER BY visit_last_action_time DESC
                LIMIT 1;