{"record":{"id":"cc049afadde28bd0","repo":"hashicorp/terraform","slug":"s-canceled","errorCode":null,"errorMessage":"%s canceled.","messagePattern":"(.+?) canceled\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote/backend_common.go","lineNumber":366,"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(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(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 *Remote) 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 generalError(\"Failed to retrieve policy check logs\", err)\n\t\t}\n\t\treader := bufio.NewReaderSize(logs, 64*1024)","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/backend/remote/backend_common.go#L348-L384","documentation":"Returned by the cost-estimation watcher when the run's cost estimate transitions to tfe.CostEstimateCanceled. The %s is msgPrefix (the 'Cost Estimation' header). It signals an externally-initiated cancellation of the cost-estimate phase of a remote run.","triggerScenarios":"During checkCostEstimation the polled ce.Status equals tfe.CostEstimateCanceled. Triggered when a user clicks 'Cancel Run' in the TFC/TFE UI mid-cost-estimate, or the run is canceled via API while cost estimation is in progress.","commonSituations":"Manual run cancellation in the UI; automated cancellation by a policy/automation; cost-estimation service issue causing TFE to mark the phase canceled; concurrent cancel during a long plan.","solutions":["Confirm the cancellation was intentional; if accidental, start a new run.","If cancellations are recurring, review who/what has cancel permissions and any automation that may abort runs.","Re-run the plan/apply once the underlying cause is resolved."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Treat a canceled cost estimate as a terminal-but-recoverable run outcome.\nif errors.Is(err, errCostEstimateCanceled) {\n    // prompt user / automation to start a new run; do not auto-retry blindly","preventionTips":["Restrict who/what can cancel runs to avoid accidental aborts.","Surface cancellation events to automation so a new run can be queued deterministically.","Do not retry a canceled run without user/automation confirmation - investigate the cancel source first."],"tags":["backend","remote-backend","cost-estimation","run","canceled","go"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}