# Buggy code
async def async_setup_frontend():
    """Configure the HACS frontend elements."""
    hacs = get_hacs()
    hacs.log.info("Setup task %s", HacsSetupTask.FRONTEND)

    # Custom view
    hacs.hass.http.register_view(HacsFrontend())

    # Custom iconset
    if "frontend_extra_module_url" not in hacs.hass.data:
        hacs.hass.data["frontend_extra_module_url"] = set()
    hacs.hass.data["frontend_extra_module_url"].add("/hacsfiles/iconset.js")

    hacs.frontend.version_running = FE_VERSION
    hacs.frontend.version_expected = await hacs.hass.async_add_executor_job(
        get_frontend_version
    )

    # Add to sidepanel
    custom_panel_config = {
        "name": "hacs-frontend",
        "embed_iframe": True,
        "trust_external": False,
        "js_url": "/hacsfiles/frontend/entrypoint.js",
    }

    config = {}
    config["_panel_custom"] = custom_panel_config

    hacs.hass.components.frontend.async_register_built_in_panel(
        component_name="custom",
        sidebar_title=hacs.configuration.sidepanel_title,
        sidebar_icon=hacs.configuration.sidepanel_icon,
        frontend_url_path="hacs",
        config=config,
        require_admin=True,
    )


# Traceback (ValueError)
2020-10-27 16:42:22 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry  for hacs
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 234, in async_setup
result = await component.async_setup_entry(hass, self)  # type: ignore
File "/config/custom_components/hacs/__init__.py", line 30, in async_setup_entry
return await hacs_ui_setup(hass, config_entry)
File "/config/custom_components/hacs/operational/setup.py", line 63, in async_setup_entry
return await async_startup_wrapper_for_config_entry()
File "/config/custom_components/hacs/operational/setup.py", line 88, in async_startup_wrapper_for_config_entry
startup_result = await async_hacs_startup()
File "/config/custom_components/hacs/operational/setup.py", line 133, in async_hacs_startup
await async_setup_frontend()
File "/config/custom_components/hacs/operational/setup_actions/frontend.py", line 38, in async_setup_frontend
hacs.hass.components.frontend.async_register_built_in_panel(
File "/usr/src/homeassistant/homeassistant/components/frontend/__init__.py", line 196, in async_register_built_in_panel
raise ValueError(f"Overwriting panel {panel.frontend_url_path}")
ValueError: Overwriting panel hacs

# Fixed code
async def async_setup_frontend():
    """Configure the HACS frontend elements."""
    hacs = get_hacs()
    hacs.log.info("Setup task %s", HacsSetupTask.FRONTEND)

    # Custom view
    hacs.hass.http.register_view(HacsFrontend())

    # Custom iconset
    if "frontend_extra_module_url" not in hacs.hass.data:
        hacs.hass.data["frontend_extra_module_url"] = set()
    hacs.hass.data["frontend_extra_module_url"].add("/hacsfiles/iconset.js")

    hacs.frontend.version_running = FE_VERSION
    hacs.frontend.version_expected = await hacs.hass.async_add_executor_job(
        get_frontend_version
    )

    # Add to sidepanel
    if "hacs" not in hacs.hass.data.get("frontend_panels", {}):
        custom_panel_config = {
            "name": "hacs-frontend",
            "embed_iframe": True,
            "trust_external": False,
            "js_url": "/hacsfiles/frontend/entrypoint.js",
        }

        config = {}
        config["_panel_custom"] = custom_panel_config

        hacs.hass.components.frontend.async_register_built_in_panel(
            component_name="custom",
            sidebar_title=hacs.configuration.sidepanel_title,
            sidebar_icon=hacs.configuration.sidepanel_icon,
            frontend_url_path="hacs",
            config=config,
            require_admin=True,
        )