{"record":{"id":"e6f2574cca20c432","repo":"hashicorp/terraform","slug":"s-canceled-e6f257","errorCode":null,"errorMessage":"%s canceled.","messagePattern":"(.+?) canceled\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/backend_common.go","lineNumber":316,"sourceCode":"\t\t\t\tif i > 0 {\n\t\t\t\t\telapsed = fmt.Sprintf(\n\t\t\t\t\t\t\" (%s elapsed)\", current.Sub(started).Truncate(30*time.Second))\n\t\t\t\t}\n\t\t\t\tb.CLI.Output(b.Colorize().Color(\"[bold]\" + msgPrefix + \":\\n\"))\n\t\t\t\tb.CLI.Output(b.Colorize().Color(\"Waiting for cost estimate to complete...\" + elapsed + \"\\n\"))\n\t\t\t}\n\t\t\tcontinue\n\t\tcase tfe.CostEstimateSkippedDueToTargeting:\n\t\t\tb.CLI.Output(b.Colorize().Color(\"[bold]\" + msgPrefix + \":\\n\"))\n\t\t\tb.CLI.Output(\"Not available for this plan, because it was created with the -target option.\")\n\t\t\tb.CLI.Output(\"\\n------------------------------------------------------------------------\")\n\t\t\treturn nil\n\t\tcase tfe.CostEstimateErrored:\n\t\t\tb.CLI.Output(msgPrefix + \" errored.\\n\")\n\t\t\tb.CLI.Output(\"\\n------------------------------------------------------------------------\")\n\t\t\treturn nil\n\t\tcase tfe.CostEstimateCanceled:\n\t\t\treturn fmt.Errorf(\"%s canceled.\", msgPrefix)\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"Unknown or unexpected cost estimate state: %s\", ce.Status)\n\t\t}\n\t}\n}\n\nfunc (b *Cloud) checkPolicy(stopCtx, cancelCtx context.Context, op *backendrun.Operation, r *tfe.Run) error {\n\tif b.CLI != nil {\n\t\tb.CLI.Output(\"\\n------------------------------------------------------------------------\\n\")\n\t}\n\tfor i, pc := range r.PolicyChecks {\n\t\t// Read the policy check logs. This is a blocking call that will only\n\t\t// return once the policy check is complete.\n\t\tlogs, err := b.client.PolicyChecks.Logs(stopCtx, pc.ID)\n\t\tif err != nil {\n\t\t\treturn b.generalError(\"Failed to retrieve policy check logs\", err)\n\t\t}\n\t\treader := bufio.NewReaderSize(logs, 64*1024)","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/backend_common.go#L298-L334","documentation":"Returned by the cost-estimation poll loop (backend_common.go:316) when the cost estimate transitions to tfe.CostEstimateCanceled. A canceled estimate means the estimate stage of the run was aborted server-side (by a user, an admin, or a system event), so Terraform stops the operation rather than proceeding without cost data.","triggerScenarios":"During a remote plan's cost-estimate phase, ce.Status == tfe.CostEstimateCanceled is observed in the switch at backend_common.go:265-319. Typically caused by someone canceling the run in the HCP/TFE UI or an org policy/job-runner cancellation.","commonSituations":"Another team member clicked 'Cancel run' in the UI while the CLI was streaming the estimate. An admin-enforced cancellation. Auto-cancel on idle in some runner configurations.","solutions":["Check the run URL / HCP UI to see who or what canceled the estimate.","Start a new plan/apply run; cancellation is not a persistent failure.","If cancellations are recurring, review runner capacity and org-level auto-cancel settings."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// On cost-estimate cancellation, start a fresh run.\nif strings.Contains(err.Error(), \"canceled.\") {\n    return startNewRun(ctx) // re-plan\n}","preventionTips":["Coordinate so only one runner operates on a workspace at a time.","Disable auto-cancel-on-idle if estimates are being cut off.","Monitor the run URL for external cancellations."],"tags":["terraform","tfe","cost-estimation","cloud-backend"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}