home-assistant/core · error · ConfigEntryNotReady

cannot_connect

Error message

cannot_connect

What it means

Raised as ConfigEntryNotReady (translation key cannot_connect) when setup fails with B2ConnectionError, B2RequestTimeout, or ConnectionReset. These are transport-level failures reaching api.backblazeb2.com; HA retries setup with exponential backoff.

Source

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

        ) from err
    except exception.NonExistentBucket as err:
        create_bucket_not_found_issue(hass, entry, entry.data[CONF_BUCKET])
        raise ConfigEntryNotReady(
            translation_domain=DOMAIN,
            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))

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Verify internet connectivity and DNS resolution for api.backblazeb2.com from the host
  2. Allow outbound HTTPS (443) to Backblaze in firewall/proxy rules
  3. Check Backblaze status page; transient errors self-heal via HA retries
  4. If persistent on constrained networks, check MTU/keepalive settings causing resets
Defensive patterns

Strategy: retry

Validate before calling

import socket
socket.gethostbyname("api.backblazeb2.com")  # quick reachability check

Type guard

import b2sdk.v2.exception as b2exc

def is_connection_error(err: BaseException) -> bool:
    return isinstance(err, (b2exc.B2ConnectionError, b2exc.B2RequestTimeout, b2exc.ConnectionReset))

Try / catch

except (exception.B2ConnectionError, exception.B2RequestTimeout, exception.ConnectionReset) as err:
    raise ConfigEntryNotReady(translation_domain=DOMAIN, translation_key="cannot_connect") from err

Prevention

When it happens

Trigger: TCP/TLS connection failure to the B2 API (B2ConnectionError), request timing out (B2RequestTimeout), or a reset connection (ConnectionReset) during authorize_account/get_bucket_by_name.

Common situations: HA host offline or DNS failing, firewall blocking egress to backblazeb2.com, ISP/route flakiness, B2 service outage.

Related errors


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