{"record":{"id":"6fd002fa5aee6bea","repo":"home-assistant/core","slug":"err-6fd002","errorCode":null,"errorMessage":"{err}","messagePattern":"\\{err\\}","errorType":"exception","errorClass":"ConfigEntryAuthFailed","httpStatus":null,"severity":"error","filePath":"homeassistant/components/aladdin_connect/__init__.py","lineNumber":51,"sourceCode":"    \"\"\"Set up Aladdin Connect Genie from a config entry.\"\"\"\n    try:\n        implementation = (\n            await config_entry_oauth2_flow.async_get_config_entry_implementation(\n                hass, entry\n            )\n        )\n    except ImplementationUnavailableError as err:\n        raise ConfigEntryNotReady(\n            translation_domain=DOMAIN,\n            translation_key=\"oauth2_implementation_unavailable\",\n        ) from err\n\n    session = config_entry_oauth2_flow.OAuth2Session(hass, entry, implementation)\n\n    try:\n        await session.async_ensure_token_valid()\n    except OAuth2TokenRequestReauthError as err:\n        raise ConfigEntryAuthFailed(err) from err\n    except (OAuth2TokenRequestError, aiohttp.ClientError) as err:\n        raise ConfigEntryNotReady from err\n\n    client = AladdinConnectClient(\n        api.AsyncConfigEntryAuth(aiohttp_client.async_get_clientsession(hass), session)\n    )\n\n    coordinator = AladdinConnectCoordinator(hass, entry, client)\n    await coordinator.async_config_entry_first_refresh()\n\n    entry.runtime_data = coordinator\n\n    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)\n\n    remove_stale_devices(hass, entry)\n\n    return True\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/aladdin_connect/__init__.py#L33-L69","documentation":"ConfigEntryAuthFailed raised during async_setup_entry when session.async_ensure_token_valid() fails with OAuth2TokenRequestReauthError. HA treats this as 'authentication failed': the refresh token was rejected by the Genie/Aladdin OAuth server, so the entry is put into re-authentication state and the user gets a repair/notification to log in again.","triggerScenarios":"Expired or revoked refresh token (password changed, token revoked server-side, account linked elsewhere), or the OAuth server responding 400/401 to the refresh grant during setup or a later token refresh.","commonSituations":"Long-idle install whose refresh token lapsed; user changed their Aladdin Connect account password; sandbox/production client mismatch; server-side cleanup of old grants.","solutions":["Open Home Assistant, go to the failing Aladdin Connect entry and complete the re-authentication flow.","Verify the account credentials work in the Aladdin Connect app.","If it recurs frequently, check for other clients repeatedly refreshing the same grant.","After re-auth, the entry should leave the failed/auth state automatically."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from homeassistant.exceptions import ConfigEntryAuthFailed\n\ntry:\n    await session.async_ensure_token_valid()\nexcept OAuth2TokenRequestReauthError as err:\n    raise ConfigEntryAuthFailed(err) from err  # HA drives re-auth UI","preventionTips":["Complete the re-auth flow promptly when HA reports the entry as failed auth.","Avoid using the same account grant from many clients simultaneously.","Handle ConfigEntryAuthFailed distinctly from ConfigEntryNotReady in custom code."],"tags":["oauth2","auth","token-refresh","reauth"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}