Skip to content

KeyError: 'refresh_token' in Spotify integration #61162

Description

@Mebus

The problem

Hallo,

currently I am seeing these erros in my HA log and the HA webinterface is sometimes not responding:

Sep 14 16:01:33 openhab hass[636]: Traceback (most recent call last):
Sep 14 16:01:33 openhab hass[636]:   File "/home/homeassistant/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 277, in async_update_ha_state
Sep 14 16:01:33 openhab hass[636]:     await self.async_device_update()
Sep 14 16:01:33 openhab hass[636]:   File "/home/homeassistant/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 473, in async_device_update
Sep 14 16:01:33 openhab hass[636]:     raise exc
Sep 14 16:01:33 openhab hass[636]:   File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
Sep 14 16:01:33 openhab hass[636]:     result = self.fn(*self.args, **self.kwargs)
Sep 14 16:01:33 openhab hass[636]:   File "/home/homeassistant/homeassistant/lib/python3.9/site-packages/homeassistant/components/spotify/media_player.py", line 210, in wrapper
Sep 14 16:01:33 openhab hass[636]:     result = func(self, *args, **kwargs)
Sep 14 16:01:33 openhab hass[636]:   File "/home/homeassistant/homeassistant/lib/python3.9/site-packages/homeassistant/components/spotify/media_player.py", line 487, in update
Sep 14 16:01:33 openhab hass[636]:     run_coroutine_threadsafe(
Sep 14 16:01:33 openhab hass[636]:   File "/usr/lib/python3.9/concurrent/futures/_base.py", line 440, in result
Sep 14 16:01:33 openhab hass[636]:     return self.__get_result()
Sep 14 16:01:33 openhab hass[636]:   File "/usr/lib/python3.9/concurrent/futures/_base.py", line 389, in __get_result
Sep 14 16:01:33 openhab hass[636]:     raise self._exception
Sep 14 16:01:33 openhab hass[636]:   File "/home/homeassistant/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 473, in async_ensure_token_valid
Sep 14 16:01:33 openhab hass[636]:     new_token = await self.implementation.async_refresh_token(self.token)
Sep 14 16:01:33 openhab hass[636]:   File "/home/homeassistant/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 84, in async_refresh_token
Sep 14 16:01:33 openhab hass[636]:     new_token = await self._async_refresh_token(token)
Sep 14 16:01:33 openhab hass[636]:   File "/home/homeassistant/homeassistant/lib/python3.9/site-packages/homeassistant/components/cloud/account_link.py", line 147, in _async_refresh_token
Sep 14 16:01:33 openhab hass[636]:     self.hass.data[DOMAIN], self.service, token["refresh_token"]
Sep 14 16:01:33 openhab hass[636]: KeyError: 'refresh_token'

Maybe somebody can help?

Greetings

Mebus

URL

https://www.home-assistant.io/integrations/spotify/

Version

2021.11.5

Additional information

No response

What version of Home Assistant Core has the issue?

2021.3.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Spotify

Link to integration documentation on our website

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

Metadata

Metadata

Assignees

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions