{"record":{"id":"4ae786054c87bdbb","repo":"home-assistant/core","slug":"already-in-progress","errorCode":null,"errorMessage":"already_in_progress","messagePattern":"already_in_progress","errorType":"exception","errorClass":"AbortFlow","httpStatus":null,"severity":"info","filePath":"homeassistant/components/apple_tv/config_flow.py","lineNumber":291,"sourceCode":"        # window before triggering a scan of the device. This prevents\n        # multiple scans of the device at the same time since each\n        # apple_tv device has multiple services that are discovered by\n        # zeroconf.\n        #\n        self._async_check_and_update_in_progress(host, unique_id)\n        await asyncio.sleep(DISCOVERY_AGGREGATION_TIME)\n        # Check again after sleeping in case another flow\n        # has made progress while we yielded to the event loop\n        self._async_check_and_update_in_progress(host, unique_id)\n        # Host must only be set AFTER checking and updating in progress\n        # flows or we will have a race condition where no flows move forward.\n        self.host = host\n\n    @callback\n    def _async_check_and_update_in_progress(self, host: str, unique_id: str) -> None:\n        \"\"\"Check for in-progress flows and update them with identifiers if needed.\"\"\"\n        if self.hass.config_entries.flow.async_has_matching_flow(self):\n            raise AbortFlow(\"already_in_progress\")\n\n    @override\n    def is_matching(self, other_flow: Self) -> bool:\n        \"\"\"Return True if other_flow is matching this flow.\"\"\"\n        if (\n            other_flow.context.get(\"source\") != SOURCE_ZEROCONF\n            or other_flow.host != self._host\n        ):\n            return False\n        if self.unique_id is not None:\n            # Add potentially new identifiers from this device to the existing flow\n            other_flow.all_identifiers.add(self.unique_id)\n        return True\n\n    async def async_found_zeroconf_device(\n        self, user_input: dict[str, str] | None = None\n    ) -> ConfigFlowResult:\n        \"\"\"Handle device found after Zeroconf discovery.\"\"\"","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/apple_tv/config_flow.py#L273-L309","documentation":"AbortFlow('already_in_progress') raised from the apple_tv config flow's _async_check_and_update_in_progress when another matching discovery flow (same host, source=zeroconf) is already active. HA's flow manager converts it into the standard 'already_in_progress' abort so the second discovery event attaches to the existing flow instead of creating a duplicate.","triggerScenarios":"A zeroconf discovery event arrives for an Apple TV while a flow for the same host is already in progress; after the DISCOVERY_AGGREGATION_TIME sleep the flow re-checks and finds itself matched by async_has_matching_flow, which happens when multiple mDNS records for the device fire near-simultaneously.","commonSituations":"Apple TV advertising several service types (MAP, AirPlay, Companion) at once, each triggering discovery; device re-announcing after wake or IP change; two HA instances or duplicate discovery sources racing. Usually benign - the flows merge.","solutions":["No action needed in most cases: the abort means the existing flow will complete; wait for the config entry to appear","If flows get stuck, reload the page/restart discovery by power cycling the device's network or restarting HA, then let a single flow finish","Check for duplicate discovery sources (e.g. network with two mDNS reflectors) if this appears constantly"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat already_in_progress as benign; the first flow owns the device","Avoid triggering multiple discovery sources for the same host","Restart HA if flows appear wedged in progress"],"tags":["home-assistant","apple-tv","config-flow","discovery","zeroconf"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}