{"record":{"id":"a8581f2c453717f1","repo":"home-assistant/core","slug":"not-found-source-type-query","errorCode":null,"errorMessage":"Not found {source_type}: {query}","messagePattern":"Not found (.+?): (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/braviatv/coordinator.py","lineNumber":309,"sourceCode":"        if query.startswith((\"extInput:\", \"tv:\", \"com.sony.dtv.\")):\n            return await self.async_source_start(query, source_type)\n        coarse_uri = None\n        is_numeric_search = source_type == SourceType.CHANNEL and query.isnumeric()\n        for uri, item in self.source_map.items():\n            if item[\"type\"] == source_type:\n                if is_numeric_search:\n                    num = item.get(\"dispNum\")\n                    if num and int(query) == int(num):\n                        return await self.async_source_start(uri, source_type)\n                else:\n                    title: str = item[\"title\"]\n                    if query.lower() == title.lower():\n                        return await self.async_source_start(uri, source_type)\n                    if query.lower() in title.lower():\n                        coarse_uri = uri\n        if coarse_uri:\n            return await self.async_source_start(coarse_uri, source_type)\n        raise ValueError(f\"Not found {source_type}: {query}\")\n\n    @catch_braviatv_errors\n    async def async_turn_on(self) -> None:\n        \"\"\"Turn the device on.\"\"\"\n        await self.client.turn_on()\n\n    @catch_braviatv_errors\n    async def async_turn_off(self) -> None:\n        \"\"\"Turn off device.\"\"\"\n        await self.client.turn_off()\n\n    @catch_braviatv_errors\n    async def async_set_volume_level(self, volume: float) -> None:\n        \"\"\"Set volume level, range 0..1.\"\"\"\n        await self.client.volume_level(round(volume * 100))\n\n    @catch_braviatv_errors\n    async def async_volume_up(self) -> None:","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/braviatv/coordinator.py#L291-L327","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"# before\n- action: media_player.select_source\n  target: {entity_id: media_player.sony_tv}\n  data: {source: HDMI2}\n# after (use the exact source shown in the entity's source_list)\n- action: media_player.select_source\n  target: {entity_id: media_player.sony_tv}\n  data: {source: \"HDMI 2\"}","handlingStrategy":"validation","validationCode":"sources = set(coordinator.sources)\n# or from the entity state attribute\nvalid = set(hass.states.get(entity_id).attributes[\"source_list\"])\nif source not in valid:\n    # refresh sources then fail fast with a clear message\n    raise ValueError(f\"Unknown source {source!r}; valid: {sorted(valid)}\")","typeGuard":"def is_valid_source(source: str, source_list: list[str]) -> bool:\n    return source.casefold() in {s.casefold() for s in source_list}","tryCatchPattern":"try:\n    await coordinator.async_select_source(source)\nexcept ValueError as err:\n    if err.args and err.args[0].startswith(\"Not found\"):\n        # refresh source list and surface a friendly message\n        await coordinator.async_update_sources()\n        raise\n    raise","preventionTips":["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."],"tags":["braviatv","home-assistant","invalid-input","source","value-error"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}