diff --git a/public/app/features/alerting/unified/components/rules/RulesGroup.tsx b/public/app/features/alerting/unified/components/rules/RulesGroup.tsx
index 83f0ebde0fb..aeead7db121 100644
--- a/public/app/features/alerting/unified/components/rules/RulesGroup.tsx
+++ b/public/app/features/alerting/unified/components/rules/RulesGroup.tsx
@@ -168,9 +168,9 @@ export const RulesGroup = React.memo(({ group, namespace, expandAll, viewMode }:
if (isListView) {
groupName = ;
} else if (isUngroupedRuleGroup(group.name)) {
- groupName = (
-
- );
+ const firstRuleName = group.rules[0]?.name ?? 'Unknown Rule';
+ const groupDisplayName = `${firstRuleName} (Ungrouped)`;
+ groupName = ;
}
return (
diff --git a/public/app/features/alerting/unified/rule-list/PaginatedGrafanaLoader.tsx b/public/app/features/alerting/unified/rule-list/PaginatedGrafanaLoader.tsx
index 8fffeddf261..8bb360ad6d2 100644
--- a/public/app/features/alerting/unified/rule-list/PaginatedGrafanaLoader.tsx
+++ b/public/app/features/alerting/unified/rule-list/PaginatedGrafanaLoader.tsx
@@ -162,7 +162,8 @@ export function GrafanaRuleGroupListItem({ group, namespaceName }: GrafanaRuleGr
const detailsLink = groups.detailsPageLink(GRAFANA_RULES_SOURCE_NAME, group.folderUid, group.name);
- const groupDisplayName = isUngroupedRuleGroup(group.name) ? `${group.rules[0].name} (Ungrouped)` : group.name;
+ const firstRuleName = group.rules[0]?.name ?? 'Unknown Rule';
+ const groupDisplayName = isUngroupedRuleGroup(group.name) ? `${firstRuleName} (Ungrouped)` : group.name;
return (