{"record":{"id":"d99cac74c2d692df","repo":"hashicorp/terraform","slug":"failed-to-override-w-s-d99cac","errorCode":null,"errorMessage":"Failed to override: %w\n%s\n","messagePattern":"Failed to override: %w\n(.+?)\n","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/backend_common.go","lineNumber":418,"sourceCode":"\t\t\t\t!pc.Actions.IsOverridable || !pc.Permissions.CanOverride {\n\t\t\t\treturn fmt.Errorf(\"%s soft failed.\\n%s\", msgPrefix, runURL)\n\t\t\t}\n\n\t\t\tif op.AutoApprove {\n\t\t\t\tif _, err = b.client.PolicyChecks.Override(stopCtx, pc.ID); err != nil {\n\t\t\t\t\treturn b.generalError(fmt.Sprintf(\"Failed to override policy check.\\n%s\", runURL), err)\n\t\t\t\t}\n\t\t\t} else if !b.input {\n\t\t\t\treturn errPolicyOverrideNeedsUIConfirmation\n\t\t\t} else {\n\t\t\t\topts := &terraform.InputOpts{\n\t\t\t\t\tId:          \"override\",\n\t\t\t\t\tQuery:       \"\\nDo you want to override the soft failed policy check?\",\n\t\t\t\t\tDescription: \"Only 'override' will be accepted to override.\",\n\t\t\t\t}\n\t\t\t\terr = b.confirm(stopCtx, op, opts, r, \"override\")\n\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 b.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}","sourceCodeStart":400,"sourceCodeEnd":436,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/backend_common.go#L400-L436","documentation":"In the interactive override flow (backend_common.go:416-419), after the user is prompted to override a soft-failed policy, the confirm() helper returned an error that is not errRunOverridden. This wraps that error with the run URL. It indicates the override confirmation/prompt machinery itself failed (e.g. the run changed state during the prompt, a concurrent modification, or an input error).","triggerScenarios":"Reached only on the interactive path (not -auto-approve, b.input true). b.confirm(stopCtx, op, opts, r, \"override\") returned an err that is non-nil and != errRunOverridden. Distinguished from the API override failure at backend_common.go:422-424 which uses generalError.","commonSituations":"The run was discarded, errored, or externally modified while the user was answering the override prompt. Input stream error during confirmation. The run transitioned to a non-overridable state mid-prompt.","solutions":["Re-read the wrapped error text; it usually names the run-state change (e.g. run was discarded).","Start a fresh plan/apply; the failed run is typically no longer actionable.","Ensure no other user/process is concurrently mutating the same run during the prompt.","For automation, use -auto-approve to skip the interactive confirm path entirely."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Avoid concurrent mutation of the run during the override prompt.\n// Serialize operations on a workspace with a lock.","typeGuard":null,"tryCatchPattern":"// Re-fetch the run on confirm failure and retry if still overridable.\nif err != nil && err != errRunOverridden {\n    r, _ = b.client.Runs.Read(ctx, r.ID)\n    if stillOverridable(r) { return retryOverride(ctx, r) }\n    return err\n}","preventionTips":["Prevent other users/processes from mutating the run while overriding.","Prefer -auto-approve in automation to skip the interactive confirm path.","Act promptly on override prompts to avoid race windows."],"tags":["terraform","tfe","policy","override","concurrency","cloud-backend"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}