home-assistant/core · error · ValueError
Not found {source_type}: {query}
Error message
Not found {source_type}: {query} What it means
Plain ValueError('Not found {source_type}: {query}') raised at the bottom of async_source_find (coordinator.py:309) when no input/app/channel matches the query — exact numeric match on dispNum, exact case-insensitive title match, or even a coarse substring match all failed. Because ValueError is not a BraviaError, @catch_braviatv_errors does not translate it; the caller sees the raw message in the service-call error.
Source
Thrown at homeassistant/components/braviatv/coordinator.py:309
if query.startswith(("extInput:", "tv:", "com.sony.dtv.")):
return await self.async_source_start(query, source_type)
coarse_uri = None
is_numeric_search = source_type == SourceType.CHANNEL and query.isnumeric()
for uri, item in self.source_map.items():
if item["type"] == source_type:
if is_numeric_search:
num = item.get("dispNum")
if num and int(query) == int(num):
return await self.async_source_start(uri, source_type)
else:
title: str = item["title"]
if query.lower() == title.lower():
return await self.async_source_start(uri, source_type)
if query.lower() in title.lower():
coarse_uri = uri
if coarse_uri:
return await self.async_source_start(coarse_uri, source_type)
raise ValueError(f"Not found {source_type}: {query}")
@catch_braviatv_errors
async def async_turn_on(self) -> None:
"""Turn the device on."""
await self.client.turn_on()
@catch_braviatv_errors
async def async_turn_off(self) -> None:
"""Turn off device."""
await self.client.turn_off()
@catch_braviatv_errors
async def async_set_volume_level(self, volume: float) -> None:
"""Set volume level, range 0..1."""
await self.client.volume_level(round(volume * 100))
@catch_braviatv_errors
async def async_volume_up(self) -> None:View on GitHub (pinned to 58a3fdb3ea)
Solutions
- Call media_player.browse_media (or inspect the source attribute / coordinator sources) to list the exact valid source, app, and channel identifiers.
- Fix the automation/script/dashboard to use the exact title (case-insensitive) or the numeric channel dispNum.
- Re-enable the HDMI input on the TV if the source disappeared from the list.
- For apps, use the app title exactly as the TV registers it (substring fallback exists, but the string must appear in some title).
Example fix
# before
- action: media_player.select_source
target: {entity_id: media_player.sony_tv}
data: {source: HDMI2}
# after (use the exact source shown in the entity's source_list)
- action: media_player.select_source
target: {entity_id: media_player.sony_tv}
data: {source: "HDMI 2"} Defensive patterns
Strategy: validation
Validate before calling
sources = set(coordinator.sources)
# or from the entity state attribute
valid = set(hass.states.get(entity_id).attributes["source_list"])
if source not in valid:
# refresh sources then fail fast with a clear message
raise ValueError(f"Unknown source {source!r}; valid: {sorted(valid)}") Type guard
def is_valid_source(source: str, source_list: list[str]) -> bool:
return source.casefold() in {s.casefold() for s in source_list} Try / catch
try:
await coordinator.async_select_source(source)
except ValueError as err:
if err.args and err.args[0].startswith("Not found"):
# refresh source list and surface a friendly message
await coordinator.async_update_sources()
raise
raise Prevention
- Derive source names from the entity's source_list attribute, never hardcode them.
- Re-validate stored source names after TV firmware updates.
- For channels use the numeric dispNum exactly as returned by the API.
When it happens
Trigger: media_player.select_source with a source name not in the TV's input list; play_media with media_id (channel number or app name) that does not exist: for channels the query must match a dispNum exactly as integer; for apps it must equal or be a substring of a registered app title.
Common situations: Source list changed on the TV (input renamed/removed, HDMI input disabled) so a stale source name is used in an automation/script; typo in app name; channel number outside the configured channel list; using a source label from a different TV model.
Related errors
- Invalid media type: {media_type}
- Media not found: {media_content_type} / {media_content_id}
- command_error_offline
- command_error
- update_error_not_found
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/a8581f2c453717f1.
Report an issue: GitHub.