Skip to content

Bug: deleting a v2 library that ever held a container returns 500 #39117

Description

@bmtcril

Where: DELETE /api/libraries/v2/<lib>/ (content_libraries/rest_api/libraries.py
deleteapi/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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugReport of or fix for something that isn't working as intendedhelp wantedReady to be picked up by anyone in the community

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions