New to Kestra?
Use blueprints to kickstart your first workflows.
Find failed Kestra executions, send details to Slack, and safely restart them behind an approval gate.
When a batch of workflows fails overnight from a network drop or a downstream API timeout, an alert tells you something broke, but someone still has to open the UI and restart each run. If thirty runs failed, doing that by hand is slow and easy to lose track of.
This flow scans a namespace for failed executions, lists them in a dry run, and behind a Pause approval restarts them one by one through Kestra's restart API. After restarting, it queries the API again to check which runs cleared and which failed again.
Restarting workflows has side effects, so this flow includes safeguards:
namespace are considered.exclude_flows lists flows that should not be automatically restarted.max_replays caps how many executions are restarted in a single run.auto_replay is true and dry_run is false.Pause task waits for an operator to confirm before any restart call runs.Loop uses concurrencyLimit: 1 so executions restart one by one.query_failed_executions (io.kestra.plugin.core.http.Request) calls GET /api/v1/executions/search with filters[state][EQUALS]=FAILED and filters[namespace][EQUALS].triage_failures (io.kestra.plugin.core.output.OutputValues) filters out self-runs and flows listed in exclude_flows, then caps the list to max_replays.check_candidate_count (io.kestra.plugin.core.flow.If) branches: logs clean if no runs failed, or sends a Slack alert with the failing executions and start times.evaluate_replay_permission (io.kestra.plugin.core.flow.If) checks whether auto_replay is true and dry_run is false.approve_replay (io.kestra.plugin.core.flow.Pause) waits for confirmation before issuing restarts.restart_candidates (io.kestra.plugin.core.flow.Loop) calls POST /api/v1/executions/{id}/actions/restart for each execution one at a time.settling_delay (io.kestra.plugin.core.flow.Sleep) waits 15 seconds to give restarted executions time to initialize.verify_post_restart_states re-queries the API and notify_resolution_slack posts the final count of remaining failures.Running this as a Kestra flow means you don't need external monitoring scripts or cron jobs to check your cluster. Native HTTP tasks and Pause gates handle the API calls and human approval directly.
exclude_flows to keep those out of the replay queue.concurrencyLimit: 1) and caps batch size with max_replays.api_token so the HTTP requests include the authorization header.SLACK_WEBHOOK_URL: Webhook URL for posting triage alerts and resolution summaries.company.team).dry_run: true to discover failed executions without triggering restarts.dry_run: false and auto_replay: true, then approve the Pause task.hourly_failure_sweep for continuous automated dead-letter monitoring.notify_triage_slack for Microsoft Teams or PagerDuty incident triggers./api/v1/logs/{executionId} to distinguish network timeouts from bad input errors.