From d5fa1f65c3d0a4e08c4cad6ede4f454f44a0477a Mon Sep 17 00:00:00 2001 From: Christophe Vila Date: Mon, 25 May 2026 15:32:50 +0200 Subject: [PATCH] fix: guard against missing tracks field in list_playlists --- spotify_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spotify_client.py b/spotify_client.py index 27ef6dc..e56b8d4 100644 --- a/spotify_client.py +++ b/spotify_client.py @@ -63,7 +63,7 @@ def list_playlists() -> list[dict]: "id": item["id"], "name": item["name"], "description": item.get("description", ""), - "tracks_total": item["tracks"]["total"], + "tracks_total": (item.get("tracks") or {}).get("total", 0), "public": item["public"], "uri": item["uri"], })