Repeated Error in Logs

I’ve noticed a number of errors in my HA log the errors seem to be associated with the Sonos integration. Here’s a clip of the log;

2022-01-10 07:24:18 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/sonos/helpers.py", line 38, in wrapper
result = funct(self, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/sonos/speaker.py", line 1016, in update_media
track_info = self.soco.get_current_track_info()
File "/usr/local/lib/python3.9/site-packages/soco/core.py", line 1827, in get_current_track_info
track.update(_parse_radio_metadata(metadata))
File "/usr/local/lib/python3.9/site-packages/soco/core.py", line 1817, in _parse_radio_metadata
if title in track["uri"] or title in urllib.parse.unquote(track["uri"]):
TypeError: 'in <string>' requires string as left operand, not NoneType
2022-01-10 07:24:19 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/sonos/helpers.py", line 38, in wrapper
result = funct(self, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/sonos/speaker.py", line 1016, in update_media
track_info = self.soco.get_current_track_info()
File "/usr/local/lib/python3.9/site-packages/soco/core.py", line 1827, in get_current_track_info
track.update(_parse_radio_metadata(metadata))
File "/usr/local/lib/python3.9/site-packages/soco/core.py", line 1817, in _parse_radio_metadata
if title in track["uri"] or title in urllib.parse.unquote(track["uri"]):
TypeError: 'in <string>' requires string as left operand, not NoneType
2022-01-10 07:24:19 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/sonos/helpers.py", line 38, in wrapper
result = funct(self, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/sonos/speaker.py", line 1016, in update_media
track_info = self.soco.get_current_track_info()
File "/usr/local/lib/python3.9/site-packages/soco/core.py", line 1827, in get_current_track_info
track.update(_parse_radio_metadata(metadata))
File "/usr/local/lib/python3.9/site-packages/soco/core.py", line 1817, in _parse_radio_metadata
if title in track["uri"] or title in urllib.parse.unquote(track["uri"]):
TypeError: 'in <string>' requires string as left operand, not NoneType
2022-01-10 07:24:19 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/sonos/helpers.py", line 38, in wrapper
result = funct(self, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/sonos/speaker.py", line 1016, in update_media
track_info = self.soco.get_current_track_info()
File "/usr/local/lib/python3.9/site-packages/soco/core.py", line 1827, in get_current_track_info
track.update(_parse_radio_metadata(metadata))
File "/usr/local/lib/python3.9/site-packages/soco/core.py", line 1817, in _parse_radio_metadata
if title in track["uri"] or title in urllib.parse.unquote(track["uri"]):
TypeError: 'in <string>' requires string as left operand, not NoneType
2022-01-10 07:24:20 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/sonos/helpers.py", line 38, in wrapper
result = funct(self, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/sonos/speaker.py", line 1016, in update_media
track_info = self.soco.get_current_track_info()
File "/usr/local/lib/python3.9/site-packages/soco/core.py", line 1827, in get_current_track_info
track.update(_parse_radio_metadata(metadata))
File "/usr/local/lib/python3.9/site-packages/soco/core.py", line 1817, in _parse_radio_metadata
if title in track["uri"] or title in urllib.parse.unquote(track["uri"]):
TypeError: 'in <string>' requires string as left operand, not NoneType

HA Details

System Health
Version	core-2021.12.8
Installation Type	Home Assistant OS
Development	false
Supervisor	true
Docker	true
User	root
Virtual Environment	false
Python Version	3.9.7
Operating System Family	Linux
Operating System Version	5.10.88
CPU Architecture	aarch64
Timezone	America/Toronto

What are your thoughts? What might be causing these errors?

Perhaps not reading the Breaking Changes in the Release Notes. :wink:

I always read “Breaking Changes” in the release notes. Sometimes I don’t understand the impact. Can you point to the one I misunderstood?

I’m aware that changes were made to Sonos but I don’t use those specific changes. Could an Automation or a Script be using them unknown to me?

Thanks

The Breaking Change for Sonos was the sonos.set_option service was removed (as well as a few attributes).

The sonos.set_option service has been removed along with the bass_level and treble_level attributes on media_player entities.

Controls for bass and treble adjustments have been moved to dedicated number entities.

(@jjlawren - #60498)

Report it as an Issue in the Core repository in GitHub.

Or wait for the next patch release, 2021.12.9, which uses a updated version of the Sonos module, and see if that eliminates the error. If it fails to fix it, then you should report it.

Thanks, I’m aware of those changes. Could an automation be using one of these services without my knowledge - I don’t write YAML (I use the UI to write scripts) and there’s no Node-Red nodes using these services.

Thank you for the response. I’ll wait until the 2021.12.9 update to see if that corrects the error. if not, I’ll report it on GitHub.

I doubt it, unless there’s a chance you installed a package (and didn’t inspect what was in it).

I agree that the most prudent choice is to wait for the next patch. Given that it’s a revised Sonos module (not a revised Sonos integration), it’s possible to simply modify your existing manifest file (for the Sonos integration). However, the instructions for finding and editing this file within the Home Assistant container are a bit involved … so just wait for the patch release.

The traceback in the first post is identical to the issue that should be fixed in 2021.12.9 as mentioned by @123. This is unrelated to any breaking changes or script/automation behavior.

2 Likes

Good to know! Thank you.