openedx / openedx/openedx-platform
Bug: deleting a v2 library that ever held a container returns 500
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.2k
- Forks
- 4.4k
- Avg merge
- 6d 18h
- Merged PRs (30d)
- 42
Description
Where: DELETE /api/libraries/v2/<lib>/ (content_libraries/rest_api/libraries.py
delete → api/libraries.py delete_library) on Tutor main (edx-platform master e2e8edf73f).
What happens: a library that only ever held components deletes cleanly
(200 {}, then 404). A library that has had a unit/subsection/section, or a
publish with side effects, answers 500 {"error": "The Studio servers encountered an error"}; the CMS log shows django.db.models.deletion.RestrictedError: Cannot delete some instances of model 'LearningPackage' because they are referenced through restricted foreign keys: 'EntityListRow.entity', 'DraftSideEffect.cause', 'DraftSideEffect.effect', 'PublishSideEffect.cause', 'PublishSideEffect.effect'.
Expected: Probably a descriptive 400 error
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at content_libraries/rest_api/libraries.py delete and follow its call to api/libraries.py delete_library. Reproduce deletion for a library that held a unit, subsection, section, or publish side effects, then inspect how the RestrictedError is handled. Done means the endpoint returns a descriptive 400 instead of the current 500.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100