home-assistant/core · error · ServiceValidationError

config_entry_not_loaded

config_entry_not_loaded

Error message

Config entry not loaded.

What it means

ServiceValidationError with translation_key config_entry_not_loaded, raised by adguard's _get_adguard_instances helper when a domain service (add_url, remove_url, etc.) is invoked but hass.config_entries.async_loaded_entries(DOMAIN) returns nothing. It signals user-facing misconfiguration: the service exists but no AdGuard Home config entry is currently loaded to act on.

Source

Thrown at homeassistant/components/adguard/__init__.py:69

@dataclass
class AdGuardData:
    """Adguard data type."""

    client: AdGuardHome
    version: str


async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
    """Set up the component."""

    def _get_adguard_instances(hass: HomeAssistant) -> list[AdGuardHome]:
        """Get the AdGuardHome instances."""
        entries: list[AdGuardConfigEntry] = hass.config_entries.async_loaded_entries(
            DOMAIN
        )
        if not entries:
            raise ServiceValidationError(
                translation_domain=DOMAIN, translation_key="config_entry_not_loaded"
            )
        return [entry.runtime_data.client for entry in entries]

    async def add_url(call: ServiceCall) -> None:
        """Service call to add a new filter subscription to AdGuard Home."""
        for adguard in _get_adguard_instances(call.hass):
            await adguard.filtering.add_url(
                allowlist=False, name=call.data[CONF_NAME], url=call.data[CONF_URL]
            )

    async def remove_url(call: ServiceCall) -> None:
        """Service call to remove a filter subscription from AdGuard Home."""
        for adguard in _get_adguard_instances(call.hass):
            await adguard.filtering.remove_url(allowlist=False, url=call.data[CONF_URL])

    async def enable_url(call: ServiceCall) -> None:
        """Service call to enable a filter subscription in AdGuard Home."""

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Open Settings > Devices & Services and confirm the AdGuard Home entry exists, is enabled, and shows as Loaded (no setup errors).
  2. Reload the AdGuard Home entry (or restart Home Assistant) if it is in a failed/retry state, then retry the service call.
  3. Fix connectivity to the AdGuard Home host/port and credentials if entry setup keeps failing — that is the root cause of the entry not being loaded.
  4. Remove or guard automations/scripts that call adguard services so they only run when the integration is active (e.g. condition on integration state).
Defensive patterns

Strategy: validation

Validate before calling

def adguard_ready(hass: HomeAssistant) -> bool:
    """True when at least one AdGuard entry is loaded and services can act."""
    return bool(hass.config_entries.async_loaded_entries(DOMAIN))

Try / catch

from homeassistant.exceptions import ServiceValidationError

try:
    await hass.services.async_call("adguard", "add_url", service_data)
except ServiceValidationError as err:
    # no loaded AdGuard entry: fix integration state, not the service call
    _LOGGER.warning("AdGuard service skipped: %s", err)

Prevention

When it happens

Trigger: Calling adguard.add_url / adguard.remove_url (or any adguard service registered in async_setup) while the integration has no loaded entries — entry disabled, failed to set up, was removed, or Home Assistant is still starting and the entry has not initialized yet.

Common situations: User disabled the AdGuard Home integration but kept automations calling its services; entry in a retry/failed state after AdGuard server outage; service called during startup before async_setup_entry completes; entry removed but stale automations/scripts remain.

Related errors


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