home-assistant/core · error · ConfigEntryAuthFailed

Brunt could not connect with username: {self.config_entry.da

Error message

Brunt could not connect with username: {self.config_entry.data[CONF_USERNAME]}.

What it means

ConfigEntryAuthFailed raised when the Brunt login call fails with ClientResponseError during _async_setup. This is a terminal setup failure: HA marks the entry as failed auth (requires reauthentication) instead of retrying. The message includes the configured username.

Source

Thrown at homeassistant/components/brunt/coordinator.py:58

            name="brunt",
            update_interval=REGULAR_INTERVAL,
        )

    @override
    async def _async_setup(self) -> None:
        session = async_get_clientsession(self.hass)

        self.bapi = BruntClientAsync(
            username=self.config_entry.data[CONF_USERNAME],
            password=self.config_entry.data[CONF_PASSWORD],
            session=session,
        )
        try:
            await self.bapi.async_login()
        except ServerDisconnectedError as exc:
            raise ConfigEntryNotReady("Brunt not ready to connect.") from exc
        except ClientResponseError as exc:
            raise ConfigEntryAuthFailed(
                "Brunt could not connect with username:"
                f" {self.config_entry.data[CONF_USERNAME]}."
            ) from exc

    @override
    async def _async_update_data(self) -> dict[str | None, Thing]:
        """Fetch data from the Brunt endpoint for all Things.

        Error 403 is the API response for any kind of
        authentication error (failed password or email)
        Error 401 is the API response for things that are not
        part of the account, could happen when a device is
        deleted from the account.
        """
        try:
            async with timeout(10):
                things = await self.bapi.async_get_things(force=True)
                return {thing.serial: thing for thing in things}

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Open the entry's reauthentication prompt in HA (Settings > Devices & Services > Brunt) and re-enter correct credentials
  2. Verify the same username/password works in the Brunt app
  3. If the account was deleted, remove the integration entry
Defensive patterns

Strategy: try-catch

Try / catch

# Framework-level: ConfigEntryAuthFailed moves the entry to SETUP_ERROR and
# triggers a reauth flow. Users fix it via the reauthentication prompt, not code.
if entry.state is ConfigEntryState.SETUP_ERROR:
    # start reauth flow with correct Brunt credentials

Prevention

When it happens

Trigger: Wrong username or password in the config entry (Brunt returns an HTTP error on login); password changed on the account; account locked; API responding with an HTTP error status (e.g. 4xx) to the login request.

Common situations: User changed their Brunt password and HA still stores old credentials; typo in username during initial setup; account deleted or suspended.

Related errors


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