Dont crash if a single provider could not be loaded
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 19 Dec 2025 01:40:29 +0000 (02:40 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 19 Dec 2025 01:40:29 +0000 (02:40 +0100)
music_assistant/mass.py

index 74e57c5030c7680f738a1f35ee98178aba33022d..645e3c9e7df2dd3297d3853a693ca06d84fa9a05 100644 (file)
@@ -630,8 +630,10 @@ class MusicAssistant:
             prov_conf.last_error = str(exc)
             self.config.set(f"{CONF_PROVIDERS}/{instance_id}/last_error", str(exc))
 
-            # auto schedule a retry if the (re)load failed (handled exceptions only)
-            if isinstance(exc, MusicAssistantError) and allow_retry:
+            # auto schedule a retry if the (re)load failed with a handled exception
+            # unhandled exceptions (e.g. ValueError) are likely bugs that won't resolve themselves
+            will_retry = allow_retry and isinstance(exc, MusicAssistantError)
+            if will_retry:
                 self.call_later(
                     120,
                     self.load_provider,
@@ -639,16 +641,15 @@ class MusicAssistant:
                     allow_retry,
                     task_id=task_id,
                 )
-                LOGGER.warning(
-                    "Error loading provider(instance) %s: %s (will be retried later)",
-                    prov_conf.name or prov_conf.instance_id,
-                    str(exc) or exc.__class__.__name__,
-                    # log full stack trace if verbose logging is enabled
-                    exc_info=exc if LOGGER.isEnabledFor(VERBOSE_LOG_LEVEL) else None,
-                )
-                return
-            # raise in all other situations
-            raise
+            LOGGER.warning(
+                "Error loading provider(instance) %s: %s%s",
+                prov_conf.name or prov_conf.instance_id,
+                str(exc) or exc.__class__.__name__,
+                " (will be retried later)" if will_retry else "",
+                # log full stack trace if verbose logging is enabled
+                exc_info=exc if LOGGER.isEnabledFor(VERBOSE_LOG_LEVEL) else None,
+            )
+            return
 
         # (re)load any dependents if needed
         for dep_prov in self.providers: