Deleting groups that are mentioned in acitivities clogs the log

Nextcloud version (eg, 20.0.5): 20.0.6
Operating system and version (eg, Ubuntu 20.04): Raspbian 10 (buster), kernel: Linux 5.10.11-v8+ aarch64
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.38
PHP version (eg, 7.4): 7.4.13

The issue you are facing:

When deleting a group that is mentioned in an activity notification, an unneccessary error message is logged every time the activity is read.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Have activity notifications configured so that users are notified whenever a group assignment changes.
  2. Unassign a user (x) from a group (y)
  3. Delete said group (y)
  4. Logging in with said user (x), navigate to the activities app
  5. Observe the nextcloud log

Now this is not exactly a support issue but more of a nuisance that should be addressed. In the scenario as described above, every request of the user’s activities will result in a logged error message like this:

{“reqId”:“YCQGHhIoGWz8VAMROPIIFAAACg4”,“level”:3,“time”:“2021-02-10T17:13:19+01:00”,“remoteAddr”:“",“user”:"”,“app”:“activity”,“method”:“GET”,“url”:"/ocs/v2.php/apps/activity/api/v2/activity/all?format=json&previews=true&since=0",“message”:{“Exception”:“OCP\RichObjectStrings\InvalidObjectExeption”,“Message”:“Parameter is undefined”,“Code”:0,“Trace”:[{“file”:"/var/www/nextcloud/apps/activity/lib/GroupHelper.php",“line”:91,“function”:“validate”,“class”:“OC\RichObjectStrings\Validator”,“type”:"->"},{“file”:"/var/www/nextcloud/apps/activity/lib/Data.php",“line”:244,“function”:“addActivity”,“class”:“OCA\Activity\GroupHelper”,“type”:"->"},{“file”:"/var/www/nextcloud/apps/activity/lib/Controller/APIv2Controller.php",“line”:273,“function”:“get”,“class”:“OCA\Activity\Data”,“type”:"->"},{“file”:"/var/www/nextcloud/apps/activity/lib/Controller/APIv2Controller.php",“line”:209,“function”:“get”,“class”:“OCA\Activity\Controller\APIv2Controller”,“type”:"->"},{“file”:"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",“line”:169,“function”:“getFilter”,“class”:“OCA\Activity\Controller\APIv2Controller”,“type”:"->"},{“file”:"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",“line”:100,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->"},{“file”:"/var/www/nextcloud/lib/private/AppFramework/App.php",“line”:152,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->"},{“file”:"/var/www/nextcloud/lib/private/Route/Router.php",“line”:309,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:"::"},{“file”:"/var/www/nextcloud/ocs/v1.php",“line”:88,“function”:“match”,“class”:“OC\Route\Router”,“type”:"->"},{“file”:"/var/www/nextcloud/ocs/v2.php",“line”:24,“args”:["/var/www/nextcloud/ocs/v1.php"],“function”:“require_once”}],“File”:"/var/www/nextcloud/lib/private/RichObjectStrings/Validator.php",“Line”:72,“CustomMessage”:"–"},“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36”,“version”:“20.0.6.1”}

This is especially annoying on servers with a lot of users and in combination with the Nextcloud smartphone apps, as every poll for activities from the apps will result in said log message. The nextcloud log inflates rather quick this way. Plus, you have a hard time scanning the log for important information when 90% of the log’s content consists of the message above.