Several error messages in the log file

Hi, I’ve been getting various error messages in the log file for some time now. Maybe you know how to fix them.

1.ERROR API[2025-09-05 19:47:32 UTC] [90ac5] Uncaught exception in API: You do not have access to this resource because it requires ‘view’ access for the website id = 2. /www/htdocs/*****/matomo*/core/Access.php:760

2.ERROR API[2025-09-05 15:33:48 UTC] [cd3f3] Uncaught exception in API: /libs/Zend/Db/Statement/Pdo.php(236): SQLSTATE[HY000]: General error: 2006 MySQL server has gone away [Query: ?token_auth=removed, CLI mode: 0]

3.ERROR API[2025-08-21 09:34:43 UTC] [f53c8] Uncaught exception in API: /www/htdocs/*****/matomo*/core/Site.php(155): An unexpected website was found in the request: website id was set to ‘all’ . [Query: ?date=yesterday&module=API&format=json&method=API.getSuggestedValuesForSegment&segmentName=userId&idSite=all&segment=&period=day, CLI mode: 0]

4.ERROR API[2025-08-16 23:33:53 UTC] [f030f] Uncaught exception in API: /www/htdocs/*****/matomo*/libs/Zend/Db/Statement/Mysqli.php(77): Mysqli prepare error: MySQL server has gone away [Query: ?token_auth=removed, CLI mode: 0]

A quick update on my problems. Maybe it will help others too. After a lot of trial and error, I found the solution (with the help of ChatGPT), as follows.

Solution for this message: Uncaught exception in API: You do not have access to this resource because it has ‘view’ access for the website id = 2

I added the users to the database table *_access with at least view rights (even though they are stored as superusers in the *_user table). Since then, everything has been fine.

Solution for all API errors. My archiving script now runs outside of Matomo on a subdomain and is called cleanly via cron job without tokens, etc. Thank you, ChatGPT.Archiving runs cleanly and without errors every 30 minutes.