{"record":{"id":"0989fe4983d930f3","repo":"hashicorp/terraform","slug":"task-stage-s","errorCode":null,"errorMessage":"Task Stage %s.","messagePattern":"Task Stage (.+?)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/backend_taskStages.go","lineNumber":142,"sourceCode":"\t\t\t}\n\t\t\tif ok {\n\t\t\t\tif b.CLI != nil {\n\t\t\t\t\tb.CLI.Output(\"------------------------------------------------------------------------\")\n\t\t\t\t}\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\tcase tfe.TaskStageCanceled, tfe.TaskStageErrored, tfe.TaskStageFailed:\n\t\t\tok, e := processSummarizers(ctx, output, stage, summarizers, errs)\n\t\t\tif e != nil {\n\t\t\t\terrs = e\n\t\t\t}\n\t\t\tif ok {\n\t\t\t\tif b.CLI != nil {\n\t\t\t\t\tb.CLI.Output(\"------------------------------------------------------------------------\")\n\t\t\t\t}\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\treturn false, fmt.Errorf(\"Task Stage %s.\", stage.Status)\n\t\tcase tfe.TaskStageAwaitingOverride:\n\t\t\tok, e := processSummarizers(ctx, output, stage, summarizers, errs)\n\t\t\tif e != nil {\n\t\t\t\terrs = e\n\t\t\t}\n\t\t\tif ok {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\tcont, err := b.processStageOverrides(ctx, output, stage.ID)\n\t\t\tif err != nil {\n\t\t\t\terrs = errors.Join(errs, err)\n\t\t\t} else {\n\t\t\t\tif b.CLI != nil {\n\t\t\t\t\tb.CLI.Output(\"------------------------------------------------------------------------\")\n\t\t\t\t}\n\t\t\t\treturn cont, nil\n\t\t\t}\n\t\tcase tfe.TaskStageUnreachable:","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/cloud/backend_taskStages.go#L124-L160","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Inspect stage status before relying on the result.\nswitch stage.Status {\ncase tfe.TaskStageCanceled, tfe.TaskStageErrored, tfe.TaskStageFailed:\n    // surface stage details; do not treat as success\n}","typeGuard":"func taskStageFailed(s tfe.TaskStageStatus) bool {\n    switch s {\n    case tfe.TaskStageCanceled, tfe.TaskStageErrored, tfe.TaskStageFailed:\n        return true\n    }\n    return false\n}","tryCatchPattern":"ok, err := processSummarizers(ctx, output, stage, summarizers, errs)\nif !ok && taskStageFailed(stage.Status) {\n    return false, fmt.Errorf(\"Task Stage %s.\", stage.Status)\n}","preventionTips":["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."],"tags":["terraform","run-tasks","policy","task-stage","hcp-terraform"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}