Random Database errors in Admin log

This only happens 1 or 2 times a week. Only thing that has changed was my template.

Each time the error may vary.

Not sure if someone or something it trying to hack my sql or some other problem. I see the word in this wood grain and wondering of someone was searching the site for wood grain and got an error. I went to our site and searched for this but no errors on page or admin log.

I have cleared cache and temp files and did database maintenance.

I am not using any quick search addons as they don’t work good with this template. Just the regular search feature.

website is


Error: Duplicate entry ‘2177-261fd43d60e2b7311b231e7cc12a6860’ for key 1 (1062)

Query: INSERT INTO cscart_stat_product_search (sess_id, search_string, md5, quantity) VALUES (‘2177’, ‘a:9:{s:5:"match";s:3:"any";s:5:"pfull";s:1:"Y";s:9:"pkeywords";s:1:"Y";s:5:"pname";s:1:"Y";s:6:"pshort";s:1:"Y";s:1:"q";s:10:"wood grain";s:16:"search_performed";s:1:"Y";s:6:"status";s:1:"A";s:7:"subcats";s:1:"Y";}’, ‘261fd43d60e2b7311b231e7cc12a6860’, ‘0’)


/home/content/07/4755107/html/core/fn.database.php (db_error): 259

/home/content/07/4755107/html/addons/statistics/controllers/customer/products.post.php (db_query): 59

/home/content/07/4755107/html/core/fn.control.php (include): 580

/home/content/07/4755107/html/core/fn.control.php (fn_run_controller): 434

/home/content/07/4755107/html/index.php (fn_dispatch): 31

I too have seen these specific database errors in the admin log.

I use v2.14 and hoped that moving up to 2.2 would fix these errors. I see that it has to do with cscart_stat_product_search table. I usually check the table and optimizing it in phpMyAdmin, to make sure MySQL doesn't report any errors.

As last resort, I clear my temporary cache files from site root /var/cache, but these files help the site run fast so I do it sparingly. This gives relief to the errors, but after time I get the errors again. The worst side effect of these errors is that they overload MySQL (long queries).

Also, I have made sure that php, apache and MySQL are up to date on the server (if you use a dedicated server or choose a better host). This has gone a long way towards fixing long queries with cs-cart.

My guess is the error is a result of the /var/cache getting corrupted.

Just my 2 cents.