diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 37b4fbe60e6..65d1a576434 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -2786,7 +2786,9 @@ def _async_abort_entries_match( Requires `already_configured` in strings.json in user visible flows. """ if match_dict is None: - match_dict = {} # Match any entry + if other_entries: + raise data_entry_flow.AbortFlow("already_configured") # Match any entry + return for entry in other_entries: options_items = entry.options.items() data_items = entry.data.items() diff --git a/tests/test_config_entries.py b/tests/test_config_entries.py index a051e09066e..7d9509a46fa 100644 --- a/tests/test_config_entries.py +++ b/tests/test_config_entries.py @@ -5334,6 +5334,19 @@ async def test_async_abort_entries_match( assert result["type"] == FlowResultType.ABORT assert result["reason"] == reason + # For a domain with no entries, there should never be a match + mock_integration(hass, MockModule("not_comp", async_setup_entry=mock_setup_entry)) + mock_platform(hass, "not_comp.config_flow", None) + + with mock_config_flow("not_comp", TestFlow), mock_config_flow("invalid_flow", 5): + result = await manager.flow.async_init( + "not_comp", context={"source": config_entries.SOURCE_USER} + ) + await hass.async_block_till_done() + + assert result["type"] == FlowResultType.ABORT + assert result["reason"] == "no_match" + @pytest.mark.parametrize( ("matchers", "reason"),