diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 30a74b7665..855ae27482 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1262,7 +1262,10 @@ def modify_items(lib, mods, dels, query, write, move, album, confirm): for obj in objs: obj.update(mods) for field in dels: - del obj[field] + try: + del obj[field] + except KeyError: + pass if ui.show_model_changes(obj): changed.add(obj) diff --git a/docs/changelog.rst b/docs/changelog.rst index 5dfc0c5aee..d92d729ccb 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -17,6 +17,9 @@ Fixed: * We now print a better error message when the database file is corrupted. * :doc:`/plugins/discogs`: Only prompt for authentication when running the :ref:`import-cmd` command. :bug:`1123` +* When deleting fields with the :ref:`modify-cmd` command, do not crash when + the field cannot be removed (i.e., when it does not exist, when it is a + built-in field, or when it is a computed field). :ref:`1124` .. _Plex: https://plex.tv/