Authenticating with SAML gives "An account with that username already exists." error

Summary

Just set up SSO with SAML and logging in gives “An account with that username already exists.” error.

Steps to reproduce

The authentication works correctly. However, since the username already exists (up until now we are using LDAP for authentication) it throws this error. It seems to want to create a new user. How do I tell it that the user is the same and it should just login using the existing user?

Expected behavior
I expect the user to login via the SSO interface, and then be logged into Mattermost with the same user they’ve always used.

Observed behavior
I observer an error “An account with that username already exists.” error in the web browser. The mattermost.log shows

createUserOrGuest: An account with that username already exists., invalid input: entity: User field: username value:

I worked around the issue by changing AuthService to “saml” for all the users. This works for us, as all the users are in our LDAP system and the SSO system, but I would think getting into PostgreSQL will be impractical for some sites.