{"record":{"id":"072ad607dbf0e1ea","repo":"hashicorp/terraform","slug":"invalid-task-stage-status-s","errorCode":null,"errorMessage":"Invalid Task stage status: %s ","messagePattern":"Invalid Task stage status: (.+?) ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/backend_taskStages.go","lineNumber":163,"sourceCode":"\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:\n\t\t\treturn false, nil\n\t\tdefault:\n\t\t\treturn false, fmt.Errorf(\"Invalid Task stage status: %s \", stage.Status)\n\t\t}\n\t\treturn false, errs\n\t})\n}\n\nfunc processSummarizers(ctx *IntegrationContext, output IntegrationOutputWriter, stage *tfe.TaskStage, summarizers []taskStageSummarizer, errs error) (bool, error) {\n\tfor _, s := range summarizers {\n\t\tcont, msg, err := s.Summarize(ctx, output, stage)\n\t\tif err != nil {\n\t\t\terrs = errors.Join(errs, err)\n\t\t\tbreak\n\t\t}\n\n\t\tif !cont {\n\t\t\tcontinue\n\t\t}\n\n\t\t// cont is true and we must continue to poll","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/cloud/backend_taskStages.go#L145-L181","documentation":"Thrown in the default branch of the switch over stage.Status in the task-stage processing loop. Handled statuses include running, awaiting-confirmation, canceled/errored/failed, awaiting-override, and unreachable. Any other status value from the TFE TaskStages API hits this default — it's a guard against the API returning an unrecognized status the client doesn't know how to process.","triggerScenarios":"The TFE/HCP API returns a task stage status that this version of the go-tfe client/cloud backend does not recognize — e.g. a new status added server-side after the client was built, or a malformed status string. This is effectively a client/server version skew or an internal bug.","commonSituations":"HCP Terraform introduced a new task stage status not yet handled by the Terraform client version in use; using an older Terraform against a newer TFE; a corrupted API response with an unexpected status value.","solutions":["Upgrade Terraform to a version whose cloud backend handles the newer task stage statuses.","Upgrade/verify the TFE instance returns statuses compatible with this Terraform version.","Report the unrecognized status (from the message) to the Terraform team.","Retry; a transient malformed response may not recur."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Whitelist known statuses before processing.\nvar known = map[tfe.TaskStageStatus]bool{\n    tfe.TaskStageRunning: true, tfe.TaskStageAwaitingConfirmation: true,\n    tfe.TaskStageCanceled: true, tfe.TaskStageErrored: true, tfe.TaskStageFailed: true,\n    tfe.TaskStageAwaitingOverride: true, tfe.TaskStageUnreachable: true,\n}\nif !known[stage.Status] { /* surface version skew */ }","typeGuard":"func taskStatusKnown(s tfe.TaskStageStatus) bool {\n    switch s {\n    case tfe.TaskStageRunning, tfe.TaskStageAwaitingConfirmation,\n         tfe.TaskStageCanceled, tfe.TaskStageErrored, tfe.TaskStageFailed,\n         tfe.TaskStageAwaitingOverride, tfe.TaskStageUnreachable:\n        return true\n    }\n    return false\n}","tryCatchPattern":"// default branch already does this; treat as a signal to upgrade client.","preventionTips":["Keep Terraform and TFE versions compatible (upgrade together).","Report unrecognized task stage statuses to the Terraform team.","Retry once for transient malformed responses."],"tags":["terraform","run-tasks","task-stage","api-contract","version-skew","internal-bug"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}