{"record":{"id":"c3c126464d31e158","repo":"home-assistant/core","slug":"cannot-connect-c3c126","errorCode":"cannot_connect","errorMessage":"cannot_connect","messagePattern":"cannot_connect","errorType":"validation","errorClass":"InputValidationError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/bond/config_flow.py","lineNumber":60,"sourceCode":"    with contextlib.suppress(ClientConnectionError):\n        response = await bond.token()\n    return response.get(\"token\")\n\n\nasync def _validate_input(hass: HomeAssistant, data: dict[str, Any]) -> tuple[str, str]:\n    \"\"\"Validate the user input allows us to connect.\"\"\"\n\n    bond = Bond(\n        data[CONF_HOST],\n        data[CONF_ACCESS_TOKEN],\n        session=async_get_clientsession(hass),\n        requestor_uuid=RequestorUUID.HOME_ASSISTANT,\n    )\n    try:\n        hub = BondHub(bond, data[CONF_HOST])\n        await hub.setup(max_devices=1)\n    except ClientConnectionError as error:\n        raise InputValidationError(\"cannot_connect\") from error\n    except ClientResponseError as error:\n        if error.status == HTTPStatus.UNAUTHORIZED:\n            raise InputValidationError(\"invalid_auth\") from error\n        raise InputValidationError(\"unknown\") from error\n    except Exception as error:\n        _LOGGER.exception(\"Unexpected exception\")\n        raise InputValidationError(\"unknown\") from error\n\n    # Return unique ID from the hub to be stored in the config entry.\n    if not hub.bond_id:\n        raise InputValidationError(\"old_firmware\")\n\n    return hub.bond_id, hub.name\n\n\nclass BondConfigFlow(ConfigFlow, domain=DOMAIN):\n    \"\"\"Handle a config flow for Bond.\"\"\"\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/bond/config_flow.py#L42-L78","documentation":"Raised during the Bond integration config flow when validating user input (host + access token). The flow builds a Bond API client, calls BondHub.setup(max_devices=1), and translates aiohttp's ClientConnectionError into InputValidationError('cannot_connect'). It means the HTTP transport to the Bond hub failed before any response was read: DNS failure, connection refused, timeout, or SSL handshake breakdown.","triggerScenarios":"Calling async_step_user / async_step_discovery_confirmation with a CONF_HOST that is unreachable, a wrong IP after the hub changed address, the Bond hub being powered off, or a firewall dropping TCP 30001 (Bond local API). BondHub.setup() performs the initial HTTP request(s); any ClientConnectionError from it maps here.","commonSituations":"Hub moved to a new DHCP IP, mDNS-discovered address stale, VLAN/IoT network segmentation blocking the client, hub firmware rebooting mid-request.","solutions":["Verify the host reachable: ping the Bond hub IP or open http://<host>:30001/v2/devices in a browser.","Fix or re-discover the host address (re-run discovery in the config flow) and resubmit.","Check firewall/VLAN rules allow the Home Assistant host to reach the Bond hub on its local API port.","If the hub was rebooting, wait ~30s and retry the config step."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import asyncio, socket\n\nasync def bond_host_reachable(host: str, port: int = 30001, timeout: float = 3.0) -> bool:\n    try:\n        _, w = await asyncio.wait_for(asyncio.open_connection(host, port), timeout)\n        w.close()\n        return True\n    except (OSError, asyncio.TimeoutError):\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    await validate_input(hass, data)\nexcept InputValidationError as err:\n    if err.error_status == \"cannot_connect\":  # show host unreachable message\n        ...","preventionTips":["Reserve a static DHCP lease for the Bond hub so CONF_HOST never goes stale.","Run discovery before manual entry so the flow validates the address live.","Keep the Bond hub on the same VLAN as Home Assistant or open its local API port."],"tags":["bond","config-flow","network","connection","home-assistant"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}