I am having an issue while updating an existing community contact/account: Contact has 'created by' and 'Owner' set to Salesforce Standard User. And then from that Contact I created a community user. Now with REST API I am trying to update that Contact's 'owner' field to Community user I see following error: Portal users cannot own partner accounts
This error message is confusing. Basically, the system will prevent portal users from owning contacts that are linked to any kind of account, according to this knowledge article: https://help.salesforce.com/articleView?id=000004491&language=en_US&type=1
When you try to enable an Account as a Partner Account and any of the contacts associated to that account are owned by a Partner User, you would receive this error message. If Partner Account enabling was allowed to go through successfully in such a scenario, it could result in Partner Users owning Partner Contacts which is not allowed by design.
The only way to enable the Account as a Partner Account, when this situation is encountered, is to update the ownership of the associated Contacts so that they are owned by internal, non-Partner Users.
The only way for you to avoid the error is to use a beforeInsert trigger to change the contact ownership to an internal Salesforce license user.