diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/rules/find_rules_status_route.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/rules/find_rules_status_route.ts index ba996c7251d6..01c75079dca0 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/rules/find_rules_status_route.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/rules/find_rules_status_route.ts @@ -68,7 +68,10 @@ export const createFindRulesStatusRoute: Hapi.ServerRoute = { return { ...(await acc), [id]: { - current_status: convertToSnakeCase(lastFiveErrorsForId.saved_objects[0].attributes), + current_status: + lastFiveErrorsForId.saved_objects.length > 0 + ? convertToSnakeCase(lastFiveErrorsForId.saved_objects[0].attributes) + : null, failures: lastFiveErrorsForId.saved_objects .slice(1) .map(errorItem => convertToSnakeCase(errorItem.attributes)), diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/types.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/types.ts index 182d9fcfb8cc..86731d2e7cd6 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/types.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/types.ts @@ -58,8 +58,8 @@ export interface IRuleStatusAttributes { export interface RuleStatusResponse { [key: string]: { - current_status: IRuleStatusAttributes; - failures: IRuleStatusAttributes[]; + current_status: IRuleStatusAttributes | null | undefined; + failures: IRuleStatusAttributes[] | null | undefined; }; }