Hello there
Sorry for reviving this post
This happened to me recently with WHMCS 8.7.3 and PHP 8.1
It happened when a user opened a ticket through an email and between the round trip emails they added 2 people from the organization to the ticket and that is when the error appeared.
Whenever the recipient of the email is more than one person and does not have permissions in the ticket, whmcs throws me the error.
To solve it, we proceeded to register the 2 people of the organization as part of support and with permissions in the ticket office.
After that I stop throwing errors and I manage to import the emails correctly.
Another problem that this generated is that every time the email piping cron was executed, it imported again the same emails that were throwing an error.
Hope this can help someone experiencing the same thing
Email Import Log: