diff --git a/license_manager/apps/api/v1/views.py b/license_manager/apps/api/v1/views.py index 8c90f93d..507fc810 100644 --- a/license_manager/apps/api/v1/views.py +++ b/license_manager/apps/api/v1/views.py @@ -1,5 +1,6 @@ import logging from collections import OrderedDict +from contextlib import suppress from uuid import uuid4 from celery import chain @@ -654,7 +655,8 @@ def _trim_already_associated_emails(self, subscription_plan, user_emails): already_associated_licenses.values_list('user_email', flat=True) ) for email in already_associated_emails: - trimmed_emails.remove(email.lower()) + with suppress(ValueError): + trimmed_emails.remove(email.lower()) return trimmed_emails, already_associated_emails