hashicorp/terraform · warning
execution halted
Error message
execution halted
What it means
Returned in opApply (internal/backend/local/backend_apply.go:136) when, after a successful Plan but before confirmation/auto-apply, stopCtx.Err() is non-nil. This means a stop (graceful interrupt) request was received during the final batch of resource plan calls. Terraform treats this as the operation being halted and reports OperationFailure rather than proceeding to the apply.
Source
Thrown at internal/backend/local/backend_apply.go:136
return
}
trivialPlan := !plan.Applyable
hasUI := op.UIOut != nil && op.UIIn != nil
mustConfirm := hasUI && !op.AutoApprove && !trivialPlan
op.View.Plan(plan, schemas)
if testHookStopPlanApply != nil {
testHookStopPlanApply()
}
// Check if we've been stopped before going through confirmation, or
// skipping confirmation in the case of -auto-approve.
// This can currently happen if a single stop request was received
// during the final batch of resource plan calls, so no operations were
// forced to abort, and no errors were returned from Plan.
if stopCtx.Err() != nil {
diags = diags.Append(errors.New("execution halted"))
runningOp.Result = backendrun.OperationFailure
op.ReportResult(runningOp, diags)
return
}
if mustConfirm {
var desc, query string
switch op.PlanMode {
case plans.DestroyMode:
if op.Workspace != "default" {
query = "Do you really want to destroy all resources in workspace \"" + op.Workspace + "\"?"
} else {
query = "Do you really want to destroy all resources?"
}
desc = "Terraform will destroy all your managed infrastructure, as shown above.\n" +
"There is no undo. Only 'yes' will be accepted to confirm."
case plans.RefreshOnlyMode:
if len(plan.ActionTargetAddrs) > 0 {View on GitHub (pinned to c9def3e214)
Solutions
- Simply re-run the command; no state was changed because the apply never started.
- If using automation with deadlines, increase the timeout so it does not elapse during planning.
- Avoid sending interrupts near the end of a plan; use 'terraform stop' through the proper API and wait for graceful completion.
Defensive patterns
Strategy: try-catch
Try / catch
// This error is non-recoverable for the current run; treat as a clean stop.
if stopCtx.Err() != nil {
runningOp.Result = backendrun.OperationFailure
return // surface 'execution halted' to the user
} Prevention
- Avoid sending interrupts near the end of a plan.
- Size automation timeouts so they do not elapse during the plan phase.
- Document that re-running the command is the correct recovery action.
When it happens
Trigger: The user sends an interrupt (Ctrl-C / SIGINT) or the operation's Stop function is invoked during the narrow window after plan completes and before the confirmation prompt or -auto-apply apply begins. The plan itself returned no error but the stop context is already cancelled.
Common situations: Pressing Ctrl-C exactly as a plan finishes; automation that cancels a run mid-plan; long plans where the user gives up at the last second; orchestrators that set a deadline that elapses right at the plan/apply boundary.
Related errors
AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07).
Data as JSON: /api/errors/66d35e1060483d55.
Report an issue: GitHub.