hashicorp/terraform · error

%s canceled.

Error message

%s canceled.

What it means

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.

Source

Thrown at internal/cloud/backend_common.go:316

				if i > 0 {
					elapsed = fmt.Sprintf(
						" (%s elapsed)", current.Sub(started).Truncate(30*time.Second))
				}
				b.CLI.Output(b.Colorize().Color("[bold]" + msgPrefix + ":\n"))
				b.CLI.Output(b.Colorize().Color("Waiting for cost estimate to complete..." + elapsed + "\n"))
			}
			continue
		case tfe.CostEstimateSkippedDueToTargeting:
			b.CLI.Output(b.Colorize().Color("[bold]" + msgPrefix + ":\n"))
			b.CLI.Output("Not available for this plan, because it was created with the -target option.")
			b.CLI.Output("\n------------------------------------------------------------------------")
			return nil
		case tfe.CostEstimateErrored:
			b.CLI.Output(msgPrefix + " errored.\n")
			b.CLI.Output("\n------------------------------------------------------------------------")
			return nil
		case tfe.CostEstimateCanceled:
			return fmt.Errorf("%s canceled.", msgPrefix)
		default:
			return fmt.Errorf("Unknown or unexpected cost estimate state: %s", ce.Status)
		}
	}
}

func (b *Cloud) checkPolicy(stopCtx, cancelCtx context.Context, op *backendrun.Operation, r *tfe.Run) error {
	if b.CLI != nil {
		b.CLI.Output("\n------------------------------------------------------------------------\n")
	}
	for i, pc := range r.PolicyChecks {
		// Read the policy check logs. This is a blocking call that will only
		// return once the policy check is complete.
		logs, err := b.client.PolicyChecks.Logs(stopCtx, pc.ID)
		if err != nil {
			return b.generalError("Failed to retrieve policy check logs", err)
		}
		reader := bufio.NewReaderSize(logs, 64*1024)

View on GitHub (pinned to c9def3e214)

Solutions

  1. Check the run URL / HCP UI to see who or what canceled the estimate.
  2. Start a new plan/apply run; cancellation is not a persistent failure.
  3. If cancellations are recurring, review runner capacity and org-level auto-cancel settings.
Defensive patterns

Strategy: retry

Try / catch

// On cost-estimate cancellation, start a fresh run.
if strings.Contains(err.Error(), "canceled.") {
    return startNewRun(ctx) // re-plan
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07). Data as JSON: /api/errors/e6f2574cca20c432. Report an issue: GitHub.