Getting the error "There was an error in iCloud Preferences"

Instead of launching iCloud in System Preferences (and getting that error), open Internet Accounts and log into your iCloud account to reset your credentials. That fixed this error from iCloud preferences for me.