hashicorp/terraform · error
Task Stage .
Error message
Task Stage %s.
What it means
Thrown in the TaskStageCanceled/Errored/Failed branch of the task-stage status switch when processSummarizers returns ok=false. The stage reached a failure/cancellation terminal state and the summarizers could not produce a continuation, so the backend reports the stage status as the error. This relates to run tasks / policy enforcement stages in HCP Terraform.
Solutions
- Review the task stage details in HCP Terraform UI to see why it canceled/errored/failed.
- Fix the underlying policy violation or task configuration, then start a new run.
- If policy failures are expected and override is permitted, use the override workflow (prompted interactively).
- Check task stage logs and the third-party task service for errors.
Defensive patterns
Strategy: try-catch
Validate before calling
// Inspect stage status before relying on the result.
switch stage.Status {
case tfe.TaskStageCanceled, tfe.TaskStageErrored, tfe.TaskStageFailed:
// surface stage details; do not treat as success
} Type guard
func taskStageFailed(s tfe.TaskStageStatus) bool {
switch s {
case tfe.TaskStageCanceled, tfe.TaskStageErrored, tfe.TaskStageFailed:
return true
}
return false
} Try / catch
ok, err := processSummarizers(ctx, output, stage, summarizers, errs)
if !ok && taskStageFailed(stage.Status) {
return false, fmt.Errorf("Task Stage %s.", stage.Status)
} Prevention
- Fix policy/task failures at source rather than relying on override.
- Review task stage logs in HCP Terraform when a stage fails.
- Keep run-task configurations healthy and test policies before broad rollout.
When it happens
Trigger: A run task stage (e.g. a policy check or custom task) ended in canceled, errored, or failed status, and there was no successful override or summarizer output to recover. The run cannot proceed past this stage.
Common situations: A Sentinel policy check failed and was not overridden; a custom run task errored during execution; a task stage was canceled (manually or by timeout); prerequisite task failed causing this stage to fail.
Related errors
- Failed to override
- Invalid Task stage status
- Task Stage ' ': .
- error loading variables
- error loading workspace
AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11).
Data as JSON: /api/errors/0989fe4983d930f3.
Report an issue: GitHub.
Appendix: source
Thrown at internal/cloud/backend_taskStages.go:142
}
if ok {
if b.CLI != nil {
b.CLI.Output("------------------------------------------------------------------------")
}
return true, nil
}
case tfe.TaskStageCanceled, tfe.TaskStageErrored, tfe.TaskStageFailed:
ok, e := processSummarizers(ctx, output, stage, summarizers, errs)
if e != nil {
errs = e
}
if ok {
if b.CLI != nil {
b.CLI.Output("------------------------------------------------------------------------")
}
return true, nil
}
return false, fmt.Errorf("Task Stage %s.", stage.Status)
case tfe.TaskStageAwaitingOverride:
ok, e := processSummarizers(ctx, output, stage, summarizers, errs)
if e != nil {
errs = e
}
if ok {
return true, nil
}
cont, err := b.processStageOverrides(ctx, output, stage.ID)
if err != nil {
errs = errors.Join(errs, err)
} else {
if b.CLI != nil {
b.CLI.Output("------------------------------------------------------------------------")
}
return cont, nil
}
case tfe.TaskStageUnreachable:View on GitHub (pinned to d32a084675)