# Buggy code
def check_torrent_health(self, data_item, forced=False):
    # TODO: stop triggering multiple checks over a single infohash by e.g. selection and click signals
    infohash = data_item["infohash"]

    if "health" not in self.model.column_position:
        return
    # Check if the entry still exists in the table
    row = self.model.item_uid_map.get(infohash)
    if row is None:
        return
    data_item = self.model.data_items[row]
    if not forced and data_item.get("health", HEALTH_UNCHECKED) != HEALTH_UNCHECKED:
        return
    data_item["health"] = HEALTH_CHECKING
    health_cell_index = self.model.index(row, self.model.column_position["health"])
    self.model.dataChanged.emit(health_cell_index, health_cell_index, [])

    TriblerNetworkRequest(
        "metadata/torrents/%s/health" % infohash,
        self.on_health_response,
        url_params={"nowait": True, "refresh": True},
        capture_core_errors=False,
        priority=QNetworkRequest.LowPriority,
    )


# Traceback (KeyError)
Traceback (most recent call last):,
File "src\run_tribler.py", line 179, in <module>,
File "src\tribler-gui\tribler_gui\utilities.py", line 382, in trackback_wrapper,
File "src\tribler-gui\tribler_gui\event_request_manager.py", line 116, in on_read_data,
File "src\tribler-gui\tribler_gui\event_request_manager.py", line 77, in tribler_started_event,
File "src\tribler-gui\tribler_gui\utilities.py", line 382, in trackback_wrapper,
File "src\tribler-gui\tribler_gui\tribler_window.py", line 488, in on_tribler_started,
File "src\tribler-gui\tribler_gui\widgets\channelcontentswidget.py", line 124, in initialize_content_page,
File "src\tribler-gui\tribler_gui\widgets\triblertablecontrollers.py", line 297, in __init__,
File "src\tribler-gui\tribler_gui\widgets\triblertablecontrollers.py", line 93, in __init__,
File "src\tribler-gui\tribler_gui\widgets\triblertablecontrollers.py", line 195, in __init__,
File "src\tribler-gui\tribler_gui\widgets\triblertablecontrollers.py", line 53, in __init__,
tribler_gui.utilities.CreationTraceback,
The above exception was the direct cause of the following exception:,
Traceback (most recent call last):,
File "src\tribler-gui\tribler_gui\utilities.py", line 385, in trackback_wrapper,
File "src\tribler-gui\tribler_gui\utilities.py", line 382, in trackback_wrapper,
File "src\tribler-gui\tribler_gui\widgets\triblertablecontrollers.py", line 54, in <lambda>,
File "src\tribler-gui\tribler_gui\widgets\triblertablecontrollers.py", line 135, in check_torrent_health,
KeyError: 'infohash'

# Fixed code
def check_torrent_health(self, data_item, forced=False):
    # TODO: stop triggering multiple checks over a single infohash by e.g. selection and click signals
    if not dict_item_is_any_of(data_item, "type", [REGULAR_TORRENT]):
        return

    infohash = data_item["infohash"]

    if "health" not in self.model.column_position:
        return
    # Check if the entry still exists in the table
    row = self.model.item_uid_map.get(infohash)
    if row is None:
        return
    data_item = self.model.data_items[row]
    if not forced and data_item.get("health", HEALTH_UNCHECKED) != HEALTH_UNCHECKED:
        return
    data_item["health"] = HEALTH_CHECKING
    health_cell_index = self.model.index(row, self.model.column_position["health"])
    self.model.dataChanged.emit(health_cell_index, health_cell_index, [])

    TriblerNetworkRequest(
        "metadata/torrents/%s/health" % infohash,
        self.on_health_response,
        url_params={"nowait": True, "refresh": True},
        capture_core_errors=False,
        priority=QNetworkRequest.LowPriority,
    )