{"record":{"id":"c8e0fbb293f1e36f","repo":"home-assistant/core","slug":"trusted-networks-is-not-configured","errorCode":null,"errorMessage":"trusted_networks is not configured","messagePattern":"trusted_networks is not configured","errorType":"exception","errorClass":"InvalidAuthError","httpStatus":null,"severity":"error","filePath":"homeassistant/auth/providers/trusted_networks.py","lineNumber":196,"sourceCode":"    @override\n    async def async_user_meta_for_credentials(\n        self, credentials: Credentials\n    ) -> UserMeta:\n        \"\"\"Return extra user metadata for credentials.\n\n        Trusted network auth provider should never create new user.\n        \"\"\"\n        raise NotImplementedError\n\n    @callback\n    def async_validate_access(self, ip_addr: IPAddress) -> None:\n        \"\"\"Make sure the access from trusted networks.\n\n        Raise InvalidAuthError if not.\n        Raise InvalidAuthError if trusted_networks is not configured.\n        \"\"\"\n        if not self.trusted_networks:\n            raise InvalidAuthError(\"trusted_networks is not configured\")\n\n        if not any(\n            ip_addr in trusted_network for trusted_network in self.trusted_networks\n        ):\n            raise InvalidAuthError(\"Not in trusted_networks\")\n\n        if any(ip_addr in trusted_proxy for trusted_proxy in self.trusted_proxies):\n            raise InvalidAuthError(\"Can't allow access from a proxy server\")\n\n        if is_cloud_connection(self.hass):\n            raise InvalidAuthError(\"Can't allow access from Home Assistant Cloud\")\n\n    @callback\n    @override\n    def async_validate_refresh_token(\n        self, refresh_token: RefreshToken, remote_ip: str | None = None\n    ) -> None:\n        \"\"\"Verify a refresh token is still valid.\"\"\"","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/auth/providers/trusted_networks.py#L178-L214","documentation":"InvalidAuthError raised by TrustedNetworksAuthProvider.async_validate_access (homeassistant/auth/providers/trusted_networks.py:196) when the provider config has an empty/missing trusted_networks list. Without any trusted networks configured, every access attempt is rejected; this fires before the IP membership, proxy, and cloud checks that follow.","triggerScenarios":"Authenticating via the trusted_networks flow while configuration.yaml defines the provider without a trusted_networks key (or an empty list); a typo like trusted_network instead of trusted_networks silently yields no entries.","commonSituations":"Copy-pasted trusted-networks config with wrong key names; config edited to remove networks but provider left enabled; YAML indentation mistakes putting the list in the wrong block.","solutions":["Add the trusted networks under the provider, e.g. `- type: trusted_networks\\n  trusted_networks:\\n    - 192.168.1.0/24`, then restart","Validate the config with `hass --script check_config` to catch key/indentation errors","Ensure the requesting client's IP actually falls inside one of the listed networks to avoid the follow-up 'Not in trusted_networks' error"],"exampleFix":"# before (configuration.yaml)\nhomeassistant:\n  auth_providers:\n    - type: trusted_networks  # no trusted_networks key\n\n# after\nhomeassistant:\n  auth_providers:\n    - type: trusted_networks\n      trusted_networks:\n        - 192.168.1.0/24","handlingStrategy":"validation","validationCode":"if not provider.trusted_networks:\n    raise ValueError(\"configure trusted_networks before using this provider\")\nprovider.async_validate_access(ip_addr)","typeGuard":null,"tryCatchPattern":"from homeassistant.auth import InvalidAuthError\ntry:\n    provider.async_validate_access(ip_addr)\nexcept InvalidAuthError as err:\n    if \"not configured\" in str(err):\n        # config problem, not a client problem\n        raise ConfigError(\"trusted_networks missing in configuration.yaml\") from err\n    raise","preventionTips":["Always include a non-empty trusted_networks list under the trusted_networks provider","Validate YAML keys and indentation with `hass --script check_config`","Remember later checks reject proxy and cloud connections even from trusted IPs"],"tags":["auth","python","home-assistant","trusted-networks","config","ip"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}