Closed itwtds closed 2 weeks ago
Hey there @frenck, @joostlek, mind taking a look at this issue as it has been labeled with an integration (spotify
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
spotify documentation spotify source (message by IssueLinks)
I have the same issue. Has never worked since fresh HA install.
Yip, same issue for me, tried to unlink and re-link but still get the same error.
Same issue for me, I tried to install spotify on a fresh HA deshboard for the first time. No issue with the link account part but then I get the error message when trying to browse media
Same issue, "Invalid Spotify account specified" for both my account and my partner's. Both premium if that matters. It used to work just fine. Tried with re-adding the integration, the credential and rolling the secrets. I'm running the latest official docker container.
Hi I'm a new user and I have the same problem. I thought it was just me but maybe it's the same issue. Invalid Spotify account specified
I have the same issue with a new installation. Have worked fine before.
Glad im not the only one...
New user, but have not got it working here either. Same issue.
same here, not woked since fresh install
Same issue, integration was configured and working prior to updates around 3 releases back. Running latest core 2024.7.3, suervisor 2024.06.2.
The same issue with a new installation core 2024.7.3
I have the same problem
same here
Same Problem here
same issue, tried removing and reinstalling , makes no difference please can we get an update on this as its very frustrating.
I have updated to the latest ha core, still doesn't work
Is there any information I can give to assist?
Same issue with CORE 2024.8.0
Had it working fine for months. Today I tried adding my wife's account and I got the "Invalid Spotify account specified" message when trying to browse anything from her account. I got fed up and removed the integration and now I also get that error on my own account after re-adding it.
I had the same issue, but I believe it has to do with the Spotify player not recognizing the audio output sources.
I can get Spotify to play via HA if I go into Media and select Spotify as the playback destination in the bottom right corner. However, every other device/destination will say "Invalid Spotify account specified"
It's not a new install, it worked prior to 2024.8, and just randomly broke one day (I don't believe I did any updates around the time it broke).
same issue here
Add me to the list :(
Same probleme here, i reinstall the integratrion without result
Same issue here. Any time I try to browse spotify for any of my google or sonos speakers I get the same error. I have 2 premium accounts integrated that worked fine for ages.
Randomly a couple of nights ago both of my spotify accounts saw "suspicious activity", locked the accounts pending a password change. HA is the only thing that sees both accounts. After I finally got them rebuilt from scratch, I now can't play Spotify on any of my media players.
Hoping there's a fix on the way soon, this is short frustrating.
Randomly a couple of nights ago both of my spotify accounts saw "suspicious activity", locked the accounts pending a password change. HA is the only thing that sees both accounts. After I finally got them rebuilt from scratch, I now can't play Spotify on any of my media players.
this is also what triggered the issue for me. After I reset my password, HA broke.
Same issues, was logged out from spotify on all devices for some reason by spotify. When i tried to login again everyting works except the media browser. removed the application credentials and integration. THen i see it being removed from the media browser as well. Later add the integration back, the spotify button also appears in the media browser but when clicking it i get the same error. Also the logs don't show anything about this.
As this also seems to linked for me to the sonos speakers, i also removed the spotify connection in the sonos app, removed the sonos integration in HA and added them back which did not solve.
Same issues, was logged out from spotify on all devices for some reason by spotify. When i tried to login again everyting works except the media browser. removed the application credentials and integration. THen i see it being removed from the media browser as well. Later add the integration back, the spotify button also appears in the media browser but when clicking it i get the same error. Also the logs don't show anything about this.
As this also seems to linked for me to the sonos speakers, i also removed the spotify connection in the sonos app, removed the sonos integration in HA and added them back which did not solve.
Same issue here with Sonos. Tried everything it feels like
following - same
Same for me - following
Since the release of Friday it is working
New HA install, same problem.
Yes… Same problem for me… Non of my media players using Spotify on Spotcast aren’t working anymore… Invalid Spotify Account…
New HA install, some problem
Same here unfortunately
Ditto...getting same issue
Same issue here.
As owner of the sonos integration @jjlawren @PeteRager
As owner of the spotify integration @joostlek @frenck
Are you guys able to help with this issue?
My understanding is the issue is with browsing Spotify. These go through the spotify integration.
The error comes from this section of code:
Which kind of looks like its an internal problem and it's never actually going out to spotify.
I think the problem was introduced by this PR as this is where the checks originate. It was merged end of May which corresponds to the timeline of it failing in 2024.7.x
https://github.com/home-assistant/core/pull/117037
I don't have a spotify account, if someone want to donate one temporarily I can see if i can repro in the debugger
You could try commenting out line 181 and see if it starts working. That would indicate that the type check on 179 is faulty. If it still fails then the attempt to retrieve it on line 178 is faulty. It sounds like the way credentials are stored has changed and when you update they are stored in a different way. If you have a backup of your .storage directory from when it did work an compare between the backup directory and current contents should show the shift.
Same problem here, after using Spotify in HA for more then 16 months without any problems.
I had a problem since last Friday. I could no longer log in to Spotify because my password no longer met the new stricter password requirement from Spotify. My password still consisted of 8 characters and the new requirement was at least 10 characters with capital letters and numbers. So I changed the password to Spotify's new standards and I could log in again. I thought I would simply change my password at HA, by deleting old data and adding new ones. But this no longer worked. Just like everyone else here, I now get the message:
"Invalid Spotify account specified"
I look forward to a solution.
You could try commenting out line 181 and see if it starts working. That would indicate that the type check on 179 is faulty. If it still fails then the attempt to retrieve it on line 178 is faulty. It sounds like the way credentials are stored has changed and when you update they are stored in a different way. If you have a backup of your .storage directory from when it did work an compare between the backup directory and current contents should show the shift.
Thanks for checking. I commented out line 181 and rearranged the the code for indentation and it throws the following error:
Log;
Logger: homeassistant.components.websocket_api.http.connection Source: components/spotify/browse_media.py:183 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 8:46:57 PM (2 occurrences) Last logged: 8:47:00 PM
[140164256687456] Error handling message: Unknown error (unknown_error) (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/media_player/init.py", line 1304, in websocket_browse_media payload = await player.async_browse_media(media_content_type, media_content_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sonos/media_player.py", line 776, in async_browse_media return await media_browser.async_browse_media( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sonos/media_browser.py", line 141, in async_browse_media return await spotify.async_browse_media( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/spotify/browse_media.py", line 183, in async_browse_media info = entry.runtime_data ^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'runtime_data'
I did a quick diff on /config/.storage/application_credentials from an earlier known working backup to the current setup and it looks identical. I'm happy to pass you the credentials to my account if you'd like to test firsthand, just let me know your preferred way of communication and we'll get it set up.
Thanks
Thanks. That means it isn't finding the config_entry. I just created a free account will see if I can get it setup, if that doesn't work I'll take you up on your offer.
I think I got it fixed. The host name is mixed case but config entries are all upper case. Try replacing that section of code with this:
It adds .upper() to the host to make it upper case. That gets me beyond the error and i can see the spotify playlist i created
if (
parsed_url.host is None
or (entry := hass.config_entries.async_get_entry(parsed_url.host.upper())) is None
or not isinstance(entry.runtime_data, HomeAssistantSpotifyData)
):
I did a quick diff on /config/.storage/application_credentials from an earlier known working backup to the current setup and it looks identical. I'm happy to pass you the credentials to my account if you'd like to test firsthand, just let me know your preferred way of communication and we'll get it set up.
Take a look at core.config_entries in the backup vs the current version. I'd like to see what the entry looked like that worked (you can delete the secret keys) vs what the entry looks like now. Since it worked until you regen'd the credentials, I am concerned that the fix may break existing entries that haven't been updated.
I think I got it fixed. The host name is mixed case but config entries are all upper case. Try replacing that section of code with this:
It adds .upper() to the host to make it upper case. That gets me beyond the error and i can see the spotify playlist i created
if ( parsed_url.host is None or (entry := hass.config_entries.async_get_entry(parsed_url.host.upper())) is None or not isinstance(entry.runtime_data, HomeAssistantSpotifyData) ):
This looks promising! I'm able to fully browse and play media directly. Looks ready for PR.
Thanks for helping out.
I did a quick diff on /config/.storage/application_credentials from an earlier known working backup to the current setup and it looks identical. I'm happy to pass you the credentials to my account if you'd like to test firsthand, just let me know your preferred way of communication and we'll get it set up.
Take a look at core.config_entries in the backup vs the current version. I'd like to see what the entry looked like that worked (you can delete the secret keys) vs what the entry looks like now. Since it worked until you regen'd the credentials, I am concerned that the fix may break existing entries that haven't been updated.
OLD
{
"entry_id": "
--
NEW
{
"created_at": "2024-08-19T21:24:35.484636+00:00",
"data": {
"authimplementation": "spotify
--
Valid point. So having a look at core.config_entries I see that "entry_id" now contains an upper case value whereas the backup was stored in lower case.
Just for reference - I deleted the integration, wiped the app credentials, restarted HA and the linked two separate accounts. It's working without any issues.
Thank you. So we know the root cause is changing of the case in the entry Id when creating a new entry. The entry Id is an internally generated GUID. At a minimum we'll need to look for the entry id in either lowercase or upper case. Perhaps we can get the host name in the URL in the correct case. Or create the entry I'd always in lowercase. I'll evaluate those three options, see what is the cleanest and get a PR put together.
Many thanks….
JS…
Le mar. 20 août 2024 à 13:37, Pete Sage @.***> a écrit :
Thank you. So we know the root cause is changing of the case in the entry Id when creating a new entry. The entry Id is an internally generated GUID. At a minimum we'll need to look for the entry id in either lowercase or upper case. Perhaps we can get the host name in the URL in the correct case. Or create the entry I'd always in lowercase. I'll evaluate those three options, see what is the cleanest and get a PR put together.
— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/122211#issuecomment-2298642450, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGEH4FXRS4YGGJU37WX466TZSMS7DAVCNFSM6AAAAABLFMDPG6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJYGY2DENBVGA . You are receiving this because you commented.Message ID: @.***>
great findings! where can i find these files and fix this my self ? (temporarily)
great findings! where can i find these files and fix this my self ? (temporarily)
Depends on your setup, so going off a regular HAOS installation below;
You need to access your core container through the shell. For that you need the advanced SSH addon with protection mode turned off. Run 'docker exec -it homeassistant bash' and you should get an interactive shell. Run 'vi /usr/src/homeassistant/homeassistant/components/spotify/browse_media.py' and make the changes according to Pete's fix. :wq! Restart HA.
The problem
After linking multiple accounts through Spotify Developers App and adding these respective accounts to Spotify I'm now unable to browse Spotify media, I'm getting a popup stating "Invalid Spotify account specified".
I've tried to unlink the accounts, re-create the Spotify Developer App and reverting back to default. I've also tried to set a up both single account and multi account on another HA instance, with the same result.
The integration fetches artwork from Spotify and HA is able to control media players (Sonos) without any issues streaming from the Spotify account - it's the media browsing part that is broken. Logs seem to indicate that there is no devices returned, not sure if this is related. Otherwise it's no clear indications in the logs as to why it's failing.
Happy to debug if needed.
Thanks.
What version of Home Assistant Core has the issue?
core-2024.7.2 / core-2024.7.3
What was the last working version of Home Assistant Core?
core-2024.7.2
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Spotify
Link to integration documentation on our website
https://www.home-assistant.io/integrations/spotify/
Diagnostics information
diag.txt
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
Tested system restore and upgrade, cleared all integration data and credentials.