{"record":{"id":"3e91317a4f532875","repo":"hashicorp/terraform","slug":"task-stage-s-has-invalid-status-s","errorCode":null,"errorMessage":"Task stage '%s' has invalid status: %s","messagePattern":"Task stage '(.+?)' has invalid status: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote/backend_taskStages.go","lineNumber":51,"sourceCode":"\t\t}\n\n\t\tswitch stage.Status {\n\t\tcase tfe.TaskStagePending:\n\t\t\t// Waiting for it to start\n\t\t\treturn true, nil\n\t\tcase tfe.TaskStageRunning:\n\t\t\t// not a terminal status so we continue to poll\n\t\t\treturn true, nil\n\t\tcase tfe.TaskStagePassed:\n\t\t\treturn false, nil\n\t\tcase tfe.TaskStageCanceled, tfe.TaskStageErrored, tfe.TaskStageFailed:\n\t\t\treturn false, fmt.Errorf(\"Task Stage '%s': %s.\", stage.ID, stage.Status)\n\t\tcase tfe.TaskStageAwaitingOverride:\n\t\t\treturn false, fmt.Errorf(\"Task Stage '%s' awaiting override.\", stage.ID)\n\t\tcase tfe.TaskStageUnreachable:\n\t\t\treturn false, nil\n\t\tdefault:\n\t\t\treturn false, fmt.Errorf(\"Task stage '%s' has invalid status: %s\", stage.ID, stage.Status)\n\t\t}\n\t})\n}\n","sourceCodeStart":33,"sourceCodeEnd":55,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote/backend_taskStages.go#L33-L55","documentation":"Emitted by waitTaskStage (backend_taskStages.go:50-51) in the switch default branch when the API returns a TaskStage.Status value not covered by the enumerated cases (pending, running, passed, canceled, errored, failed, awaiting_override, unreachable). This indicates the client and server disagree on the set of possible statuses — typically an API version skew.","triggerScenarios":"A newer TFC/TFE server returns a task-stage status that this build of go-tfe/terraform does not recognize (e.g. a newly introduced status like 'paused' or 'skipped'), so none of the cases match and the default reports the raw status string.","commonSituations":"Client/server version mismatch: Terraform CLI built against an older go-tfe than the deployed TFE; a beta feature introducing a new status; server-side rollout of a new task lifecycle ahead of client support.","solutions":["Upgrade the Terraform CLI (and its go-tfe dependency) to a version that knows the new status.","Downgrade/align the TFE server to a version whose statuses this client recognizes.","Report the unrecognized status string to confirm whether it is a legitimate new value or a corrupted response.","Retry against a matched client/server pair to confirm the skew hypothesis."],"exampleFix":"// before\nError: Task stage 'taskstage-xxx' has invalid status: queued\n\n// after: upgrade CLI to match server\n$ terraform version  # upgrade to release supporting 'queued' status","handlingStrategy":"validation","validationCode":"// Validate the status against the known set; log unknowns explicitly for version-skew triage.\nknown := map[tfe.TaskStageStatus]bool{\n    tfe.TaskStagePending:true, tfe.TaskStageRunning:true, tfe.TaskStagePassed:true,\n    tfe.TaskStageCanceled:true, tfe.TaskStageErrored:true, tfe.TaskStageFailed:true,\n    tfe.TaskStageAwaitingOverride:true, tfe.TaskStageUnreachable:true,\n}\nif !known[stage.Status] {\n    return fmt.Errorf(\"unrecognized task stage status %q; client/server version skew\", stage.Status)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the Terraform CLI (go-tfe) version aligned with the deployed TFE server.","Add the new case to the switch when go-tfe introduces a new status constant.","Surface the raw status string in logs to speed up triage.","Test against a matched client/server pair before relying on beta task features."],"tags":["task-stage","version-mismatch","api","internal"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}