From: Marcel van der Veldt Date: Sun, 22 Feb 2026 17:16:44 +0000 (+0100) Subject: Fix race condition with enqueue_next_media on SyncGroup X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=b1b596007eb4ee96c235f693f04706b4dace20dc;p=music-assistant-server.git Fix race condition with enqueue_next_media on SyncGroup --- diff --git a/music_assistant/providers/sync_group/player.py b/music_assistant/providers/sync_group/player.py index 9a2be8d1..0392c46d 100644 --- a/music_assistant/providers/sync_group/player.py +++ b/music_assistant/providers/sync_group/player.py @@ -210,6 +210,10 @@ class SyncGroupPlayer(Player): async def enqueue_next_media(self, media: PlayerMedia) -> None: """Handle enqueuing of a next media item on the player.""" if sync_leader := self.sync_leader: + if PlayerFeature.ENQUEUE not in sync_leader.state.supported_features: + # this may happen in race conditions where we just switched sync leaders + # and the new leader doesn't support enqueueing next media. + return # Use internal handler to bypass group redirect logic and avoid infinite loop await self.mass.players._handle_enqueue_next_media(sync_leader.player_id, media)