get() returned more than one UserProfile -- it returned 2!

0 users found this article helpful

Symptoms

Some users are unable to sign in when using SSO.

In the awingu-api.service.log file, this is logged:

Jul 24 12:12:06 saas-awu14 manage.py[930897]: Task cdsessions.tasks.refresh_sso_certificate failed
                                                  Traceback (most recent call last):
                                                    File "/opt/awingu/awingu-core/virtualenv/lib/python3.11/site-packages/django_q/cluster.py", line 448, in worker
                                                      res = f(*task["args"], **task["kwargs"])
                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                    File "/opt/awingu/awingu-core/virtualenv/lib/python3.11/site-packages/awingucore/cdsessions/tasks.py", line 238, in refresh_sso_certificate
                                                      return _refresh_sso_certificate(domain, upn, rah_token, new_password)
                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                    File "/opt/awingu/awingu-core/virtualenv/lib/python3.11/site-packages/awingucore/cdsessions/tasks.py", line 351, in _refresh_sso_certificate
                                                      user_profile = UserProfile.objects.get(user__userlabel__key='upn',
                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                    File "/opt/awingu/awingu-core/virtualenv/lib/python3.11/site-packages/django/db/models/manager.py", line 85, in manager_method
                                                      return getattr(self.get_queryset(), name)(*args, **kwargs)
                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                    File "/opt/awingu/awingu-core/virtualenv/lib/python3.11/site-packages/django/db/models/query.py", line 439, in get
                                                      raise self.model.MultipleObjectsReturned(
                                                  users.models.UserProfile.MultipleObjectsReturned: get() returned more than one UserProfile -- it returned 2!
    Jul 24 12:12:06 saas-awu14 manage.py[930901]: Failed [kentucky-violet-pip-item] - get() returned more than one UserProfile -- it returned 2!
    Jul 24 12:12:06 saas-awu14 /opt/awingu/awingu-core/virtualenv/bin/gunicorn[931116]: Task a369fd47cc784a11b5659ee1da997358 failed: get() returned more than one UserProfile -- it returned 2

Cause

Within this domain, someone signed in with a different sAMAccountName before - but with the same userPrincipalName.

For example, this occurs in a scenario where the Active Directory (AD) domain administrator renames only the sAMAccountName of an AD user.

 

Resolution

Contact the support team for more info.

Was this article helpful?

Tell us how we can improve it.