This guide lists the checks and corrective actions to resolve the error, Got invalid response from API request during archiving, tracking, or log importing.

The error usually indicates that the archiver cannot retrieve a valid HTTP response from the Matomo URL. Common causes include SSL issues, blocked connections, or invalid output generated by the web server.

Confirm whether PHP or Matomo logged the issue

Check for the following: php_error.log for PHP-level errors, matomo.log for Tracker, SQL, or archiving issues, and web server error logs for request-level failures. If PHP logs are empty and Matomo does not report a related error, the issue is likely connection-related or caused by system libraries.

Unrelated errors in matomo.log

Some tracking or log importing errors are unrelated to the invalid response message but may be visible in the matomo.log when troubleshooting. These errors do not cause the archiver to fail but may interrupt tracking or stop the log importer.

  • Matomo logs unrealistic numeric values in fields such as pf_tfr, pf_srv, pf_net, or pf_dm1. Values greater than 16,000,000 are invalid and cause SQL errors. For example, the value pf_tfr=1621207625627 exceeds the expected range and cannot be stored in the database. The log importer stops on the first batch containing invalid data. If you replay logs, filtering or removing outlier values before import allows the process to complete.
  • You can also check older Safari versions (for example, iOS 9.3.5 and Safari 601.x) that are known to send invalid performance timing values that Matomo cannot process.

Test the archiving command locally

Run the archiving command using a localhost or direct IP address to determine whether the CLI environment can reach Matomo. If localhost works but the domain does not, the issue is likely SSL validation, DNS, proxying, or firewall behaviour.

php console core:archive --url=http://localhost/path-to-matomo

Check for SSL verification issues in CLI mode

If your scheduled task or cron job uses HTTPS and fails, temporarily run archiving with SSL verification disable to confirm the issue.

This should not be used permanently.

php console core:archive --url=https://your-domain/matomo --accept-invalid-ssl-certificate

If disabling SSL validation allowed the process to complete, update or reinstall your operating system’s CA bundle and confirm that the PHP binary can locate valid CA certificates.

When running Matomo locally or when SSL validation is unreliable, use the following command to avoid hostname-certificate mismatch errors.

php console core:archive --url=http://YourIPAddress/path-to/matomo --accept-invalid-ssl-certificate

These actions help identify and fix the conditions that prevent the archiver from receiving a valid HTTP response. If the error persists, it is likely caused by a web server configuration issue or security rules that block or modify requests made by the CLI archiver.

Previous FAQ: How do I fix the tracking failure ‘Request was not authenticated but should have’