home-assistant/core · error · ConfigEntryAuthFailed

invalid_auth

Error message

invalid_auth

What it means

Raised as ConfigEntryAuthFailed (translation key invalid_auth) when setup fails with exception.MissingAccountData after authorization. b2sdk has no required account data (e.g. the auth response lacks account info such as an authorization token or account ID), so the session cannot proceed; HA triggers reauth.

Source

Thrown at homeassistant/components/backblaze_b2/__init__.py:92

            translation_key="invalid_bucket_name",
        ) from err
    except exception.BadRequest as err:
        raise ConfigEntryNotReady(
            translation_domain=DOMAIN,
            translation_key="bad_request",
            translation_placeholders={"error_message": str(err)},
        ) from err
    except (
        exception.B2ConnectionError,
        exception.B2RequestTimeout,
        exception.ConnectionReset,
    ) as err:
        raise ConfigEntryNotReady(
            translation_domain=DOMAIN,
            translation_key="cannot_connect",
        ) from err
    except exception.MissingAccountData as err:
        raise ConfigEntryAuthFailed(
            translation_domain=DOMAIN,
            translation_key="invalid_auth",
        ) from err

    entry.runtime_data = bucket

    def _async_notify_backup_listeners() -> None:
        """Notify any registered backup agent listeners."""
        _LOGGER.debug("Notifying backup listeners for entry %s", entry.entry_id)
        for listener in hass.data.get(DATA_BACKUP_AGENT_LISTENERS, []):
            listener()

    entry.async_on_unload(entry.async_on_state_change(_async_notify_backup_listeners))

    async def _periodic_issue_check(_now: Any) -> None:
        """Periodically check for repair issues."""
        await async_check_for_repair_issues(hass, entry)

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Re-enter credentials via the reauth flow to rebuild the account state
  2. Update Home Assistant / b2sdk so the SDK matches current B2 API responses
  3. If reproducible, capture b2sdk logs and report; verify the key is valid in the Backblaze console
Defensive patterns

Strategy: try-catch

Type guard

import b2sdk.v2.exception as b2exc

def is_missing_account_data(err: BaseException) -> bool:
    return isinstance(err, b2exc.MissingAccountData)

Try / catch

except exception.MissingAccountData as err:
    raise ConfigEntryAuthFailed(translation_domain=DOMAIN, translation_key="invalid_auth") from err

Prevention

When it happens

Trigger: authorize_account succeeds at HTTP level but the stored account state is incomplete (missing authToken/accountId), typically when the response is inconsistent or the SDK account state was built from incompatible data.

Common situations: Rare b2sdk edge case after API changes, revoked/expired session mid-flow, mixing SDK versions with cached state in long-running processes.

Related errors


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