Upon visiting my Piwik homepage today I got a page that said "an error occurred" followed by "Piwik couldn't write to some directories (running as user 'www-data')." and a list of commands to try.
I have monitoring in place that checks whether HTTP services respond with 200 OK, aka a success status code. Obviously Piwik is not OK in this scenario, and should return 500 Internal Server Error instead.
I have put up a PR containing a possible solution for this issue. https://github.com/matomo-org/matomo/pull/17206
Thanks to you both for your hard work :-)