{"record":{"id":"c67546a68ccff63f","repo":"home-assistant/core","slug":"invalid-media-type","errorCode":"invalid_media_type","errorMessage":"Invalid media type: {media_type}","messagePattern":"Invalid media type: (.+?)","errorType":"exception","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/androidtv_remote/media_player.py","lineNumber":208,"sourceCode":"            if not media_id.isnumeric():\n                raise HomeAssistantError(\n                    translation_domain=DOMAIN,\n                    translation_key=\"invalid_channel\",\n                    translation_placeholders={\"media_id\": media_id},\n                )\n            if self._channel_set_task:\n                self._channel_set_task.cancel()\n            self._channel_set_task = asyncio.create_task(\n                self._send_key_commands(list(media_id))\n            )\n            await self._channel_set_task\n            return\n\n        if media_type in [MediaType.URL, MediaType.APP]:\n            self._send_launch_app_command(media_id)\n            return\n\n        raise HomeAssistantError(\n            translation_domain=DOMAIN,\n            translation_key=\"invalid_media_type\",\n            translation_placeholders={\"media_type\": media_type},\n        )\n\n    @override\n    async def async_browse_media(\n        self,\n        media_content_type: MediaType | str | None = None,\n        media_content_id: str | None = None,\n    ) -> BrowseMedia:\n        \"\"\"Browse apps.\"\"\"\n        children = [\n            BrowseMedia(\n                media_class=MediaClass.APP,\n                media_content_type=MediaType.APP,\n                media_content_id=app_id,\n                title=app.get(CONF_APP_NAME, \"\"),","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/androidtv_remote/media_player.py#L190-L226","documentation":"Raised as HomeAssistantError (translation invalid_media_type) when play_media receives a media_type that is neither CHANNEL, URL, nor APP. The integration supports exactly those three types; anything else is rejected before any device I/O. It is the terminal else-branch of async_play_media.","triggerScenarios":"Calling play_media with media_content_type music, video, tvshow, playlist, etc. — types valid for other media_player integrations but unsupported by androidtv_remote.","commonSituations":"Generic media-browser scripts, YAML automations copied from another integration, or frontend cards sending standard media types to an Android TV remote entity.","solutions":["Use media_content_type: channel (numeric), app, or url only.","For content in apps, launch the app with media_type app and the app link.","Adjust the automation/frontend card to not target this entity with unsupported types."],"exampleFix":"// before\naction: media_player.play_media\ntarget:\n  entity_id: media_player.living_room_tv\ndata:\n  media_content_type: music\n  media_content_id: \"song.mp3\"\n// after\naction: media_player.play_media\ntarget:\n  entity_id: media_player.living_room_tv\ndata:\n  media_content_type: app\n  media_content_id: \"https://www.youtube.com\"","handlingStrategy":"validation","validationCode":"supported = {'channel', 'url', 'app'}\nassert media_type in supported, f'unsupported media type {media_type}'","typeGuard":"def is_supported_media_type(media_type: str) -> bool:\n    return media_type in {'channel', 'url', 'app'}","tryCatchPattern":"No catch needed; correct the caller to send channel/url/app only.","preventionTips":["Target androidtv_remote entities only with channel/url/app play_media calls.","Test automations against the integration's documented media types."],"tags":["validation","media-player","androidtv","user-input"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}