"Error: invalid_request -- Invalid client_id parameter value" after deleting users from LMS

it was working fine and after i have deltee some users from my admin instance then i is start throwing me this error can anyone have solution .

error

Error: invalid_request

Invalid client_id parameter value.

Hi @Shahzad_Baloch, any chance that the users you deleted were service users, e.g. cms@openedx? These users are associated with the sso authentication created by tutor, so if you delete them, you also delete their associated authentication configs.

Running tutor dev do init (or tutor local do init if that’s what you’re using) again will re-create these configs, cf Local deployment — Tutor documentation

How can i create those users agajn with out starting from 0

This command doesn’t start from zero – it will re-create those users/SSO configs, plus run any new database migrations, but won’t clobber your existing data.


it is created this cms and cms sso but now it is giving me this error on studio and lms
can you help me to figgure it out what to do next
lms

studio

please help me to solve this issue.

Please try clearing your cookies and re-authenticating.

But if that doesn’t work, I need some more information from the shell to help you solve it – could you provide information from tutor local logs lms ?

sure i will show you the logs

these are the latest logs of lms and studio
ret = super().data
^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/serializers.py”, line 253, in data
self._data = self.to_representation(self.instance)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/serializers.py”, line 522, in to_representation
ret[field.field_name] = field.to_representation(attribute)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/edx-platform/lms/djangoapps/learner_home/serializers.py”, line 142, in to_representation
serialized_courserun = super().to_representation(instance)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/serializers.py”, line 522, in to_representation
ret[field.field_name] = field.to_representation(attribute)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/fields.py”, line 1838, in to_representation
return method(value)
^^^^^^^^^^^^^
File “/openedx/edx-platform/lms/djangoapps/learner_home/serializers.py”, line 120, in get_progressUrl
return course_progress_url(instance.course_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/edx-platform/lms/djangoapps/learner_home/utils.py”, line 70, in course_progress_url
if course_home_mfe_progress_tab_is_active(course_key):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/edx-platform/lms/djangoapps/course_home_api/toggles.py”, line 45, in course_home_mfe_progress_tab_is_active
not DisableProgressPageStackedConfig.current(course_key=course_key).disabled
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/edx-platform/openedx/core/djangoapps/config_model_utils/models.py”, line 199, in current
overrides = cls.objects.current_set().filter(multi_filter_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/query.py”, line 1436, in filter
return self._filter_or_exclude(False, args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/query.py”, line 1454, in _filter_or_exclude
clone._filter_or_exclude_inplace(negate, args, kwargs)
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/query.py”, line 1461, in _filter_or_exclude_inplace
self._query.add_q(Q(*args, **kwargs))
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1546, in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1577, in _add_q
child_clause, needed_inner = self.build_filter(
^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1405, in build_filter
return self._add_q(
^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1577, in _add_q
child_clause, needed_inner = self.build_filter(
^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1405, in build_filter
return self._add_q(
^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1577, in _add_q
child_clause, needed_inner = self.build_filter(
^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1492, in build_filter
condition = self.build_lookup(lookups, col, value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1319, in build_lookup
lookup = lookup_class(lhs, rhs)
^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/lookups.py”, line 27, in init
self.rhs = self.get_prep_lookup()
^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/fields/related_lookups.py”, line 166, in get_prep_lookup
self.rhs = target_field.get_prep_value(self.rhs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/fields/init.py”, line 2055, in get_prep_value
raise e.class(
TypeError: Field ‘id’ expected a number but got <django.contrib.sites.requests.RequestSite object at 0x7fa4310f0510>.
2025-01-21 06:16:32,978 INFO 22 [edx.footer] [user 4] [ip 110.93.237.13] api.py:479 - images/logo.png
2025-01-21 06:16:32,994 ERROR 22 [django.request] [user 4] [ip 110.93.237.13] log.py:241 - Internal Server Error: /api/learner_home/init
Traceback (most recent call last):
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/fields/init.py”, line 2053, in get_prep_value
return int(value)
^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not ‘RequestSite’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/openedx/venv/lib/python3.11/site-packages/django/core/handlers/exception.py”, line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/core/handlers/base.py”, line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/pyenv/versions/3.11.8/lib/python3.11/contextlib.py”, line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/views/decorators/csrf.py”, line 56, in wrapper_view
return view_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/views/generic/base.py”, line 104, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py”, line 509, in dispatch
response = self.handle_exception(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py”, line 469, in handle_exception
self.raise_uncaught_exception(exc)
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py”, line 480, in raise_uncaught_exception
raise exc
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py”, line 506, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/edx-platform/lms/djangoapps/learner_home/views.py”, line 471, in get
return self._initialize(request.user)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/edx-platform/lms/djangoapps/learner_home/views.py”, line 574, in _initialize
response_data = serialize_learner_home_data(learner_dash_data, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/pyenv/versions/3.11.8/lib/python3.11/contextlib.py”, line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File “/openedx/edx-platform/lms/djangoapps/learner_home/views.py”, line 451, in serialize_learner_home_data
return LearnerDashboardSerializer(data, context=context).data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/serializers.py”, line 555, in data
ret = super().data
^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/serializers.py”, line 253, in data
self._data = self.to_representation(self.instance)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/serializers.py”, line 522, in to_representation
ret[field.field_name] = field.to_representation(attribute)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/fields.py”, line 1838, in to_representation
return method(value)
^^^^^^^^^^^^^
File “/openedx/edx-platform/lms/djangoapps/learner_home/serializers.py”, line 618, in get_courses
LearnerEnrollmentSerializer(enrollment, context=self.context).data
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/serializers.py”, line 555, in data
ret = super().data
^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/serializers.py”, line 253, in data
self._data = self.to_representation(self.instance)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/serializers.py”, line 522, in to_representation
ret[field.field_name] = field.to_representation(attribute)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/edx-platform/lms/djangoapps/learner_home/serializers.py”, line 142, in to_representation
serialized_courserun = super().to_representation(instance)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/serializers.py”, line 522, in to_representation
ret[field.field_name] = field.to_representation(attribute)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/rest_framework/fields.py”, line 1838, in to_representation
return method(value)
^^^^^^^^^^^^^
File “/openedx/edx-platform/lms/djangoapps/learner_home/serializers.py”, line 120, in get_progressUrl
return course_progress_url(instance.course_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/edx-platform/lms/djangoapps/learner_home/utils.py”, line 70, in course_progress_url
if course_home_mfe_progress_tab_is_active(course_key):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/edx-platform/lms/djangoapps/course_home_api/toggles.py”, line 45, in course_home_mfe_progress_tab_is_active
not DisableProgressPageStackedConfig.current(course_key=course_key).disabled
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/edx-platform/openedx/core/djangoapps/config_model_utils/models.py”, line 199, in current
overrides = cls.objects.current_set().filter(multi_filter_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/query.py”, line 1436, in filter
return self._filter_or_exclude(False, args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/query.py”, line 1454, in _filter_or_exclude
clone._filter_or_exclude_inplace(negate, args, kwargs)
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/query.py”, line 1461, in _filter_or_exclude_inplace
self._query.add_q(Q(*args, **kwargs))
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1546, in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1577, in _add_q
child_clause, needed_inner = self.build_filter(
^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1405, in build_filter
return self._add_q(
^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1577, in _add_q
child_clause, needed_inner = self.build_filter(
^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1405, in build_filter
return self._add_q(
^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1577, in _add_q
child_clause, needed_inner = self.build_filter(
^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1492, in build_filter
condition = self.build_lookup(lookups, col, value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/sql/query.py”, line 1319, in build_lookup
lookup = lookup_class(lhs, rhs)
^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/lookups.py”, line 27, in init
self.rhs = self.get_prep_lookup()
^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/fields/related_lookups.py”, line 166, in get_prep_lookup
self.rhs = target_field.get_prep_value(self.rhs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/openedx/venv/lib/python3.11/site-packages/django/db/models/fields/init.py”, line 2055, in get_prep_value
raise e.class(
TypeError: Field ‘id’ expected a number but got <django.contrib.sites.requests.RequestSite object at 0x7fa4310f0510>.

So, this at least indicates that you’ve moved past the authentication issue :slight_smile:

But I’m not sure why you’re seeing this particular problem. Did you do anything to the edx-platform source code, like pull a new version that’s different from the first one you built your tutor stack with? If there’s a change in the python dependencies, for instance, then you may need to rebuild.

if i rebuild how much time it takes to rebuild lms and studio again?
and could you give me any detials of rebuilding it quickly ]

You can rebuild using: tutor dev launch or tutor local launch

This will re-build the images used to run openedx, and re-launch your service. It takes a while, 30-40 min with a good internet connection.

just this and it will resolve my all open edx errors or should i config all the settings again

Before we go on: is this a development/test instance you’re running? Or is it in use in production?

I ask because dev instances keep the data on your local disk (under ${tutor config printroot)/data). This data will be preserved even if you re-run launch.

But if you’re running in production, you may want to take backups of your databases before going farther.

thanks buddy i have started rebuilding by giving my terminal a command tutor dev launch

1 Like