{"record":{"id":"66d35e1060483d55","repo":"hashicorp/terraform","slug":"execution-halted","errorCode":null,"errorMessage":"execution halted","messagePattern":"execution halted","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/backend/local/backend_apply.go","lineNumber":136,"sourceCode":"\t\t\treturn\n\t\t}\n\n\t\ttrivialPlan := !plan.Applyable\n\t\thasUI := op.UIOut != nil && op.UIIn != nil\n\t\tmustConfirm := hasUI && !op.AutoApprove && !trivialPlan\n\t\top.View.Plan(plan, schemas)\n\n\t\tif testHookStopPlanApply != nil {\n\t\t\ttestHookStopPlanApply()\n\t\t}\n\n\t\t// Check if we've been stopped before going through confirmation, or\n\t\t// skipping confirmation in the case of -auto-approve.\n\t\t// This can currently happen if a single stop request was received\n\t\t// during the final batch of resource plan calls, so no operations were\n\t\t// forced to abort, and no errors were returned from Plan.\n\t\tif stopCtx.Err() != nil {\n\t\t\tdiags = diags.Append(errors.New(\"execution halted\"))\n\t\t\trunningOp.Result = backendrun.OperationFailure\n\t\t\top.ReportResult(runningOp, diags)\n\t\t\treturn\n\t\t}\n\n\t\tif mustConfirm {\n\t\t\tvar desc, query string\n\t\t\tswitch op.PlanMode {\n\t\t\tcase plans.DestroyMode:\n\t\t\t\tif op.Workspace != \"default\" {\n\t\t\t\t\tquery = \"Do you really want to destroy all resources in workspace \\\"\" + op.Workspace + \"\\\"?\"\n\t\t\t\t} else {\n\t\t\t\t\tquery = \"Do you really want to destroy all resources?\"\n\t\t\t\t}\n\t\t\t\tdesc = \"Terraform will destroy all your managed infrastructure, as shown above.\\n\" +\n\t\t\t\t\t\"There is no undo. Only 'yes' will be accepted to confirm.\"\n\t\t\tcase plans.RefreshOnlyMode:\n\t\t\t\tif len(plan.ActionTargetAddrs) > 0 {","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/local/backend_apply.go#L118-L154","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// This error is non-recoverable for the current run; treat as a clean stop.\nif stopCtx.Err() != nil {\n    runningOp.Result = backendrun.OperationFailure\n    return // surface 'execution halted' to the user\n}","preventionTips":["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."],"tags":["backend","local","apply","interrupt","context-cancelled"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}