Auto archiving returns error access

Hi all,

after upgrading to the latest version 4.1.1 (from 3.8) we started to have the following issue when we executing the auto-archive command in a windows server with task manager:

D:\php\php.exe “D:\inetpub\wwwroot\analytics/console” core:archive --accept-invalid-ssl-certificate
INFO [2021-02-22 08:54:43] 7788 ---------------------------
INFO [2021-02-22 08:54:43] 7788 INIT
INFO [2021-02-22 08:54:43] 7788 Running Matomo 4.1.1 as Super User
INFO [2021-02-22 08:54:43] 7788 ---------------------------
INFO [2021-02-22 08:54:43] 7788 NOTES
INFO [2021-02-22 08:54:43] 7788 - Async process archiving not supported, using curl requests.
INFO [2021-02-22 08:54:43] 7788 - Reports for today will be processed at most every 900 seconds. You can change this value in Matomo UI > Settings > General Settings.
INFO [2021-02-22 08:54:43] 7788 - Archiving was last executed without error 1 days 8 hours ago
INFO [2021-02-22 08:54:48] 7788 ---------------------------
INFO [2021-02-22 08:54:48] 7788 START
INFO [2021-02-22 08:54:48] 7788 Starting Matomo reports archiving…
INFO [2021-02-22 08:54:53] 7788 Start processing archives for site 1.
INFO [2021-02-22 08:54:53] 7788 Will invalidate archived reports for today in site ID = 1’s timezone (2021-02-22 00:00:00).
INFO [2021-02-22 08:54:53] 7788 Will invalidate archived reports for yesterday in site ID = 1’s timezone (2021-02-21 00:00:00).
ERROR [2021-02-22 08:54:53] 7788 Got invalid response from API request: ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2021-02-22&format=json&trigger=archivephp. Response was ‘{“result”:“error”,“message”:“You can’t access this resource as it requires a ‘superuser’ access.”}’
INFO [2021-02-22 08:54:53] 7788 Archived website id 1, period = day, date = 2021-02-22, segment = ‘’, 0 visits found. Time elapsed: 0.559s

Sometimes it works properly, sometimes it doesn’t. If we:

  1. set the parameter “Archive reports when viewed from the browser” to “Yes”, then

  2. refresh our matomo page and then

  3. we execute the command above, it works. It might be a coincidence though :slight_smile:

Any lead will be very helpful for us!

Cheers,
Michail