'Guest users cannot be record owners' error during deployment of test class to production

This has to do with the test class quering users and assigning the ownership of records to the user queried. In your case the system is returing a community user. Change the query to return a particular user profile or insert a new user and use it to assign the record ownership.


@Koustubh, I ran into this same issue today. I was deploying a single controller class for a lightning component that had nothing to do with communities and received the same error. I also already had default owners set for each community and had the community setting enabled to enforce the default owner for records created by guest users.

I "solved" this by disabling the community setting that enforces default owners for records created by guest users. It seems like this may be a bug as it appears to be doing the exact opposite of what the release notes provide for information.