diff --git a/homeassistant/components/repairs/websocket_api.py b/homeassistant/components/repairs/websocket_api.py index 92d476a8f985..4af9337bb7e2 100644 --- a/homeassistant/components/repairs/websocket_api.py +++ b/homeassistant/components/repairs/websocket_api.py @@ -72,7 +72,15 @@ def ws_ignore_issue( hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg: dict[str, Any] ) -> None: """Fix an issue.""" - ir.async_ignore_issue(hass, msg["domain"], msg["issue_id"], msg["ignore"]) + issue_registry = ir.async_get(hass) + if not issue_registry.async_get_issue(msg["domain"], msg["issue_id"]): + connection.send_error( + msg["id"], + "unknown_issue", + f"Issue '{msg['issue_id']}' not found", + ) + return + issue_registry.async_ignore(msg["domain"], msg["issue_id"], msg["ignore"]) connection.send_result(msg["id"]) diff --git a/tests/components/repairs/test_websocket_api.py b/tests/components/repairs/test_websocket_api.py index f4abff415934..03ab29fdf532 100644 --- a/tests/components/repairs/test_websocket_api.py +++ b/tests/components/repairs/test_websocket_api.py @@ -195,6 +195,10 @@ async def test_dismiss_issue( ) msg = await client.receive_json() assert not msg["success"] + assert msg["error"] == { + "code": "unknown_issue", + "message": "Issue 'no_such_issue' not found", + } await client.send_json( {