Oops… there was a problem during the request. (80 million views month)

in AWS, I am using 3 c5.4xlarge instances and a db.m6i.4xlarge DB, but randomly the “visits overview” shows this errors:

Oops… there was a problem during the request. Maybe the server had a temporary issue, or maybe you requested a report with too much data. Please try again. If this error occurs repeatedly please contact your Matomo administrator for assistance.

how to debug get more info about what could be wrong, the PHP settings I have are: php7.4 with:

pm = dynamic
pm.max_children = 500
pm.start_servers = 64
pm.min_spare_servers = 32
pm.max_spare_servers = 64
pm.max_requests = 1000

in config.ini.php I have already

log_writers[] = file

But logs only print errors like:

caused by: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘379228897’ for key ‘PRIMARY’ - in plugin Goals.

Any advice, the instances seem to be fine in resources (CPU/MEM) DB some times is over 50% CPU usage