Pcornel
Automation · Error Handling

Fail Fast

Cheat sheet · https://pcornel.dk/topic.php?topic=5974

Back to the Topic

Answer

Fail fast stops a job at the first serious error, such as set -e in Bash or $ErrorActionPreference = 'Stop', so it does not continue in an unknown state and do more damage.

Remember

  • set -e, $ErrorActionPreference = 'Stop'.
  • Prevents running in unknown state.
  • Combine with cleanup.

First checks

  • set -euo pipefail — Bash
  • $ErrorActionPreference = 'Stop' — PowerShell
  • any_errors_fatal / max_fail_percentage — Ansible

Verify in this order

error → stop immediately → report

Where it usually breaks

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5974

Confirmation

Confirm action

Continue?