diff --git a/x-pack/plugins/ml/server/models/job_service/jobs.ts b/x-pack/plugins/ml/server/models/job_service/jobs.ts index 578e48b2d2884..87a719816896a 100644 --- a/x-pack/plugins/ml/server/models/job_service/jobs.ts +++ b/x-pack/plugins/ml/server/models/job_service/jobs.ts @@ -108,9 +108,11 @@ export function jobsProvider( }) .map((rule) => rule.id); - await rulesClient.bulkDeleteRules({ - ids: ruleIds, - }); + if (ruleIds.length > 0) { + await rulesClient.bulkDeleteRules({ + ids: ruleIds, + }); + } } for (const jobId of jobIds) {