From 4f95a2f25a4457b7918b26f6ce337ac8eadba8d8 Mon Sep 17 00:00:00 2001 From: J0J0 Todos Date: Fri, 5 Dec 2025 16:46:35 +0100 Subject: [PATCH] importsource: Catch importer crash when skipping Catches a crash when "skip" is selected in the importer and task.imported_items() runs into a condition branch that supposedly should never be reached: File "beets/beets/importer/tasks.py", line 254, in imported_items assert False --- beetsplug/importsource.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/beetsplug/importsource.py b/beetsplug/importsource.py index 19b2530ba..2baf1c933 100644 --- a/beetsplug/importsource.py +++ b/beetsplug/importsource.py @@ -39,9 +39,13 @@ class ImportSourcePlugin(BeetsPlugin): ) def prevent_suggest_removal(self, session, task): - for item in task.imported_items(): - if "mb_albumid" in item: - self.stop_suggestions_for_albums.add(item.mb_albumid) + try: + for item in task.imported_items(): + if "mb_albumid" in item: + self.stop_suggestions_for_albums.add(item.mb_albumid) + except AssertionError: + # No imported items - nothing to do + pass def import_stage(self, _, task): """Event handler for albums import finished."""