I wrote the following test class for a PRM deployment and received this crazy error when running the test:
System.DmlException: Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, portal account owner must have a role: []
I searched the message boards but couldn't find any reference to the real culprit. My original thought was that the user being created was causing an error somehow. However, the real problem was that my user was not assigned a role. Hopefully this post saves someone some time tracking down the solution.
</p>
You will also see this same error (for the same reason) when trying to enable a contact as a partner or customer portal user.