home-assistant/core · error · BrowseError

Media not found: {media_content_type} / {media_content_id}

Error message

Media not found: {media_content_type} / {media_content_id}

What it means

BrowseError('Media not found: {media_content_type} / {media_content_id}') raised in async_browse_media (media_player.py:181) when a browse request supplies a non-empty media_content_id whose first path segment is neither 'apps' nor 'channels'. The browser only exposes a two-level tree: root, 'apps', and 'channels'.

Source

Thrown at homeassistant/components/braviatv/media_player.py:181

    @override
    async def async_browse_media(
        self,
        media_content_type: MediaType | str | None = None,
        media_content_id: str | None = None,
    ) -> BrowseMedia:
        """Browse apps and channels."""
        if not media_content_id:
            await self.coordinator.async_update_sources()
            return await self.async_browse_media_root()

        path = media_content_id.partition("/")
        if path[0] == "apps":
            return await self.async_browse_media_apps(True)
        if path[0] == "channels":
            return await self.async_browse_media_channels(True)

        raise BrowseError(f"Media not found: {media_content_type} / {media_content_id}")

    async def async_browse_media_root(self) -> BrowseMedia:
        """Return root media objects."""

        return BrowseMedia(
            title="Sony TV",
            media_class=MediaClass.DIRECTORY,
            media_content_id="",
            media_content_type="",
            can_play=False,
            can_expand=True,
            children=[
                await self.async_browse_media_apps(),
                await self.async_browse_media_channels(),
            ],
        )

    async def async_browse_media_apps(self, expanded: bool = False) -> BrowseMedia:

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Browse from the root (empty media_content_id) and navigate only through children the integration returns.
  2. Use exactly 'apps' or 'channels' as the top-level path segment.
  3. Clear the browser/app cache if the frontend is sending stale content IDs.
  4. If building a custom UI, pass the media_content_id verbatim from BrowseMedia.children.

Example fix

# before
await player.async_browse_media(media_content_type="directory", media_content_id="app/Netflix")
# after
await player.async_browse_media(media_content_type="directory", media_content_id="apps")
Defensive patterns

Strategy: validation

Validate before calling

root = player.async_browse_media()
valid_ids = {c.media_content_id for c in root.children}  # {'apps', 'channels'}
if media_content_id and media_content_id.partition("/")[0] not in valid_ids:
    raise BrowseError(f"Unknown browse path {media_content_id!r}")

Type guard

def is_valid_browse_path(media_content_id: str) -> bool:
    return not media_content_id or media_content_id.partition("/")[0] in ("apps", "channels")

Try / catch

from homeassistant.components.media_player.browse_media import BrowseError

try:
    node = await player.async_browse_media(media_content_type, media_content_id)
except BrowseError:
    node = await player.async_browse_media("", "")  # fall back to root

Prevention

When it happens

Trigger: media_player.browse_media called with media_content_id like 'app/Netflix', 'favorites', or a deep path — anything where partition('/')[0] is not 'apps' or 'channels'. An empty media_content_id is fine (returns the root).

Common situations: Custom Lovelace media-browser panels or scripts that construct their own content IDs instead of following the children returned by the browse tree; stale frontend cache referencing old paths after an integration update.

Related errors


AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14). Data as JSON: /api/errors/4045dd4ab45f5e23. Report an issue: GitHub.