Hi,
I tried to copy a unit from a course to a library v2. That did not work (there was an error). However, it seems to have still created units, which are not published and non-deletable.
When I try to delete those two units on the right, it does not give an error message, it just does not work.
In the CMS logs, I get:
cms-1 | 2026-03-06 15:16:08,742 ERROR 39 [django.request] [user 5] [ip 208.118.221.4] log.py:253 - Internal Server Error: /api/libraries/v2/blocks/lb:CQ:Navigation:html:naviguer-dans-la-formation-c4e9db/hierarchy/
cms-1 | Traceback (most recent call last):
cms-1 | File "/openedx/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
cms-1 | response = get_response(request)
cms-1 | ^^^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
cms-1 | response = wrapped_callback(request, *callback_args, **callback_kwargs)
cms-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
cms-1 | return view_func(request, *args, **kwargs)
cms-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 105, in view
cms-1 | return self.dispatch(request, *args, **kwargs)
cms-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/venv/lib/python3.11/site-packages/django/utils/decorators.py", line 48, in _wrapper
cms-1 | return bound_method(*args, **kwargs)
cms-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py", line 515, in dispatch
cms-1 | response = self.handle_exception(exc)
cms-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py", line 475, in handle_exception
cms-1 | self.raise_uncaught_exception(exc)
cms-1 | File "/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py", line 486, in raise_uncaught_exception
cms-1 | raise exc
cms-1 | File "/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py", line 512, in dispatch
cms-1 | response = handler(request, *args, **kwargs)
cms-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/edx-platform/openedx/core/djangoapps/content_libraries/rest_api/utils.py", line 24, in wrapped_fn
cms-1 | return fn(*args, **kwargs)
cms-1 | ^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/edx-platform/openedx/core/djangoapps/content_libraries/rest_api/blocks.py", line 377, in get
cms-1 | hierarchy = api.get_library_object_hierarchy(key)
cms-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/edx-platform/openedx/core/djangoapps/content_libraries/api/containers.py", line 641, in get_library_object_hierarchy
cms-1 | return ContainerHierarchy.create_from_library_object_key(object_key)
cms-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/edx-platform/openedx/core/djangoapps/content_libraries/api/container_metadata.py", line 252, in create_from_library_object_key
cms-1 | root_items = [get_component_from_usage_key(object_key)]
cms-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/edx-platform/openedx/core/djangoapps/xblock/api.py", line 208, in get_component_from_usage_key
cms-1 | return authoring_api.get_component_by_key(
cms-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/venv/lib/python3.11/site-packages/openedx_learning/apps/authoring/components/api.py", line 345, in get_component_by_key
cms-1 | .get(
cms-1 | ^^^^
cms-1 | File "/openedx/venv/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
cms-1 | return getattr(self.get_queryset(), name)(*args, **kwargs)
cms-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1 | File "/openedx/venv/lib/python3.11/site-packages/django/db/models/query.py", line 635, in get
cms-1 | raise self.model.DoesNotExist(
cms-1 | openedx_learning.apps.authoring.components.models.Component.DoesNotExist: Component matching query does not exist.
Is there any way to “unbreak” this state ?
Note: I actually see similar errors in the logs when just viewing the library’s page.
