{"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/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/backend_taskStages.go#L145-L181","documentation":"Returned by runTaskStage polling when stage.Status does not match any case in the switch (passed, failed, canceled, errored, awaiting_override, unreachable, pending, running). It signals a forward-incompatibility: the API returned a TaskStageStatus value the client does not know about.","triggerScenarios":"Polling a task stage whose status enum is newer than the Terraform binary's go-tfe library version. Reached via the default branch of the switch.","commonSituations":"Older Terraform binary talking to a newer TFE/HCP backend that introduced a new task stage status; version skew between client and server.","solutions":["Upgrade the Terraform CLI to a version whose go-tfe knows the new status value.","Downgrade/avoid the server feature that produces the new status until the client is upgraded.","Retry once the run settles into a known status."],"exampleFix":"// before (older client, unknown status from server)\ndefault:\n    return false, fmt.Errorf(\"Invalid Task stage status: %s \", stage.Status)\n// after: upgrade Terraform CLI so the switch has a case for the new status","handlingStrategy":"validation","validationCode":"// Refuse to poll task stages from an older client against a newer server.\nif _, known := knownTaskStageStatuses[stage.Status]; !known {\n    return fmt.Errorf(\"client too old for task status %q; upgrade Terraform\", stage.Status)\n}","typeGuard":"var knownTaskStageStatuses = map[tfe.TaskStageStatus]struct{}{\n    tfe.TaskStagePending: {}, tfe.TaskStageRunning: {}, tfe.TaskStagePassed: {},\n    tfe.TaskStageFailed: {}, tfe.TaskStageCanceled: {}, tfe.TaskStageErrored: {},\n    tfe.TaskStageAwaitingOverride: {}, tfe.TaskStageUnreachable: {},\n}","tryCatchPattern":null,"preventionTips":["Keep the Terraform CLI newer than or equal to the TFE/HCP backend.","Test new server features against a current client first.","Report unknown statuses as version-skew, not data corruption."],"tags":["terraform","cloud-backend","task-stage","version-skew","go-tfe"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}