{"record":{"id":"72b9db4c25006026","repo":"hashicorp/terraform","slug":"unknown-or-unexpected-policy-state-s","errorCode":null,"errorMessage":"Unknown or unexpected policy state: %s","messagePattern":"Unknown or unexpected policy state: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backend/remote/backend_common.go","lineNumber":483,"sourceCode":"\t\t\t\tif err != nil && err != errRunOverridden {\n\t\t\t\t\treturn fmt.Errorf(\"Failed to override: %w\\n%s\\n\", err, runURL)\n\t\t\t\t}\n\n\t\t\t\tif err != errRunOverridden {\n\t\t\t\t\tif _, err = b.client.PolicyChecks.Override(stopCtx, pc.ID); err != nil {\n\t\t\t\t\t\treturn generalError(fmt.Sprintf(\"Failed to override policy check.\\n%s\", runURL), err)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\trunURL := fmt.Sprintf(runHeader, b.hostname, b.organization, op.Workspace, r.ID)\n\t\t\t\t\tb.CLI.Output(fmt.Sprintf(\"The run needs to be manually overridden or discarded.\\n%s\\n\", runURL))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif b.CLI != nil {\n\t\t\t\tb.CLI.Output(\"------------------------------------------------------------------------\")\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"Unknown or unexpected policy state: %s\", pc.Status)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (b *Remote) confirm(stopCtx context.Context, op *backendrun.Operation, opts *terraform.InputOpts, r *tfe.Run, keyword string) error {\n\tdoneCtx, cancel := context.WithCancel(stopCtx)\n\tresult := make(chan error, 2)\n\n\tgo func() {\n\t\tdefer logging.PanicHandler()\n\n\t\t// Make sure we cancel doneCtx before we return\n\t\t// so the input command is also canceled.\n\t\tdefer cancel()\n\n\t\tfor {","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote/backend_common.go#L465-L501","documentation":"The default branch of checkPolicy()'s status switch: a policy check returned a status not covered by the known cases (PolicyPasses, PolicyErrored, PolicyHardFailed, PolicySoftFailed). Like the cost-estimate equivalent, it means the server returned a policy status this terraform build doesn't recognize.","triggerScenarios":"checkPolicy() reads pc.Status and it doesn't match any case — a newer HCP/TFE server introduced a policy lifecycle state absent from the bundled go-tfe enum; the raw status is interpolated via %s.","commonSituations":"Terraform CLI is older than the TFE/HCP server; self-hosted TFE upgraded ahead of the CLI; an experimental policy status shipped server-side.","solutions":["Upgrade terraform CLI to the latest release to pick up new policy status values.","Align self-hosted TFE and CLI versions.","Report the unknown status string if it reproduces on the latest CLI."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"var knownPolicyStatuses = map[tfe.PolicyStatus]bool{\n    tfe.PolicyPasses: true, tfe.PolicyErrored: true,\n    tfe.PolicyHardFailed: true, tfe.PolicySoftFailed: true,\n    tfe.PolicyPending: true, tfe.PolicyQueued: true, tfe.PolicyUnreachable: true,\n}\nfunc isKnownPolicyStatus(s tfe.PolicyStatus) bool { return knownPolicyStatuses[s] }","tryCatchPattern":null,"preventionTips":["Keep terraform CLI on the latest release to recognize new policy statuses.","Align self-hosted TFE and CLI versions.","Report unknown statuses that reproduce on the latest CLI."],"tags":["policy","version","compatibility"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}