Bug: Error parsing API response when performing a search
Author: HarthuzCreated Apr 21, 2025Updated Apr 21, 2025
Description:
When performing a search in the application, an error occurs while parsing the response from the Spotify API.
The error message is:
Api response: convert result failed, reason: Error("invalid type: null, expected struct SimplifiedPlaylist", line: 1, column: 273)This suggests that the application attempted to parse a null value into a SimplifiedPlaylist structure, which is not allowed.
Steps to Reproduce:
- Open the application.
- Go to the search field.
- Type any search term and submit.
- The above error is triggered.
Screenshot of the error:
Possible Cause:
The Spotify API may return null for certain fields when there are no results or missing data. The app currently expects every item to conform to the SimplifiedPlaylist structure, so it's crashing instead of handling null values gracefully.
Suggestion:
Add a check before parsing the API response to ensure that null values are handled appropriately or filtered out before deserialization.
Source: Rigellute/spotify-tui