DoesNotExist: User matching query does not exist.

3,214 views
Skip to first unread message

Omar Isai González Cerón

unread,
Aug 3, 2015, 12:28:10 PM8/3/15
to General Open edX discussion

When i erase a user from django admin this error it's made in the cms log. So i need some help in here please.



Aug  3 11:17:58 edx2 [service_variant=cms][django.request][env:sandbox] ERROR [edx2  26868] [base.py:213] - Internal Server Error: /admin/auth/user/

Traceback (most recent call last):

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 109, in get_response

    response = callback(request, *callback_args, **callback_kwargs)

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 399, in wrapper

    return self.admin_site.admin_view(view)(*args, **kwargs)

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 91, in _wrapped_view

    response = view_func(request, *args, **kwargs)

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/cache.py", line 89, in _wrapped_view_func

    response = view_func(request, *args, **kwargs)

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 196, in inner

    return view(request, *args, **kwargs)

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 25, in _wrapper

    return bound_func(*args, **kwargs)

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 91, in _wrapped_view

    response = view_func(request, *args, **kwargs)

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 21, in bound_func

    return func(self, *args2, **kwargs2)

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 1202, in changelist_view

    response = self.response_action(request, queryset=cl.get_query_set(request))

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 941, in response_action

    response = func(self, request, queryset)

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/admin/actions.py", line 47, in delete_selected

    queryset.delete()

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 514, in delete

    collector.delete()

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/deletion.py", line 61, in decorated

    func(self, *args, **kwargs)

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/deletion.py", line 269, in delete

    sender=model, instance=obj, using=self.using

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 172, in send

    response = receiver(signal=self, sender=sender, **named)

  File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/user_api/models.py", line 82, in post_delete_callback

    user_preference.user, sender._meta.db_table, user_preference.key, user_preference.value, None

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/fields/related.py", line 350, in __get__

    rel_obj = qs.get(**params)

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 366, in get

    % self.model._meta.object_name)

DoesNotExist: User matching query does not exist.

Mike Wanders

unread,
Sep 10, 2015, 6:11:37 AM9/10/15
to General Open edX discussion
I have the exact same error in my Cypress installation. Can anybody help?

Thanks.

Ryan Wong

unread,
Oct 6, 2015, 8:02:35 AM10/6/15
to General Open edX discussion
I encountered the same error. Anyone help?

Thanks.
Ryan

Anna Callahan

unread,
Oct 20, 2015, 1:39:43 PM10/20/15
to General Open edX discussion
I'm also encountering this error

Ovnicraft

unread,
Oct 21, 2015, 12:08:43 AM10/21/15
to edx-...@googlegroups.com
Hi, if you consider this is a bug please open an issue following: https://github.com/edx/edx-platform#issue-tracker

Regards,

--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/9e917e61-76d1-42b7-9d9e-0a9d422ba34a%40googlegroups.com.



--

campi

unread,
Jan 12, 2016, 7:37:02 AM1/12/16
to General Open edX discussion
I have the same error. There is not solution yet?

campi

unread,
Feb 12, 2016, 4:27:44 AM2/12/16
to General Open edX discussion
I have found the reason for this.

Django admin page is not able to delete the UserPreference element associated to the User.

You need to access your MySQL DB, and in the user_api_userpreference table, delete manually the row that corresponds with the user you want to delete.

For example, if your user have ID 2,

mysql> delete from user_api_userpreference where user_id = '2';

After that, then you can delete the user in Django admin page without any problems.

Camilo Aguilar

unread,
Mar 6, 2018, 6:33:39 PM3/6/18
to General Open edX discussion
We are running into the same in Ginkgo with openassessment. When submissions are made through Studio, they end up being stored with user_id 'student'. Then when the LMS loads them up, it tries to make the relation with 'student' in the database and it obviously doesn't exist. 
Reply all
Reply to author
Forward
0 new messages