{"record":{"id":"3338458f3a335e27","repo":"home-assistant/core","slug":"authentication-failed-333845","errorCode":"authentication_failed","errorMessage":"authentication_failed","messagePattern":"authentication_failed","errorType":"exception","errorClass":"ConfigEntryAuthFailed","httpStatus":null,"severity":"error","filePath":"homeassistant/components/bosch_alarm/__init__.py","lineNumber":49,"sourceCode":"    return True\n\n\nasync def async_setup_entry(hass: HomeAssistant, entry: BoschAlarmConfigEntry) -> bool:\n    \"\"\"Set up Bosch Alarm from a config entry.\"\"\"\n\n    panel = Panel(\n        host=entry.data[CONF_HOST],\n        port=entry.data[CONF_PORT],\n        automation_code=entry.data.get(CONF_PASSWORD),\n        installer_or_user_code=entry.data.get(\n            CONF_INSTALLER_CODE, entry.data.get(CONF_USER_CODE)\n        ),\n    )\n    try:\n        await panel.connect()\n    except (PermissionError, ValueError) as err:\n        await panel.disconnect()\n        raise ConfigEntryAuthFailed(\n            translation_domain=DOMAIN, translation_key=\"authentication_failed\"\n        ) from err\n    except (TimeoutError, OSError, ConnectionRefusedError, SSLError) as err:\n        await panel.disconnect()\n        raise ConfigEntryNotReady(\n            translation_domain=DOMAIN,\n            translation_key=\"cannot_connect\",\n        ) from err\n\n    entry.runtime_data = panel\n\n    device_registry = dr.async_get(hass)\n\n    mac = entry.data.get(CONF_MAC)\n\n    device_registry.async_get_or_create(\n        config_entry_id=entry.entry_id,\n        connections={(CONNECTION_NETWORK_MAC, mac)} if mac else set(),","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/bosch_alarm/__init__.py#L31-L67","documentation":"Raised during bosch_alarm config entry setup: panel.connect() failed with PermissionError or ValueError, which the bosch_alarm library uses for rejected credentials (bad/locked-out automation code, installer or user code). The integration disconnects the panel and raises ConfigEntryAuthFailed with translation_key 'authentication_failed', pushing the user into re-authentication.","triggerScenarios":"Connecting with a wrong CONF_PASSWORD (automation code), wrong installer/user code, panel account locked after repeated failures, or code entered in the wrong field (user code where installer code is configured).","commonSituations":"Typo in codes at config time, panel firmware locking the account after failed attempts, codes changed by the installer since setup.","solutions":["Open the integration entry and re-authenticate with the correct automation/installer/user codes.","If the panel locked the account after failed attempts, wait the lockout period or unlock it at the panel, then retry.","Confirm which code each field expects (installer code vs user code) in the integration docs and re-enter."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"codes = {\n    \"password\": entry.data.get(\"password\"),\n    \"code\": entry.data.get(\"installer_code\", entry.data.get(\"user_code\")),\n}\nif not all(isinstance(v, str) and v.isdigit() and 4 <= len(v) <= 8 for v in codes.values()):\n    raise ValueError(\"codes must be numeric, 4-8 digits\")  # check before connect()","typeGuard":null,"tryCatchPattern":"try:\n    await panel.connect()\nexcept (PermissionError, ValueError) as err:\n    await panel.disconnect()\n    raise ConfigEntryAuthFailed(...) from err  # drives HA re-auth UI","preventionTips":["Validate code format (digits only) before connecting.","Avoid repeated failed attempts — panels lock out after several bad codes.","Store installer and user codes separately; do not swap the fields."],"tags":["bosch-alarm","authentication","config-entry","home-assistant"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}