{"record":{"id":"fc8aadb60e3e1ffc","repo":"hashicorp/terraform","slug":"failed-to-override-w-s","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/backend/remote/backend_common.go","lineNumber":466,"sourceCode":"\n\t\t\tif op.Type == backendrun.OperationTypePlan || op.UIOut == nil || op.UIIn == nil ||\n\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 generalError(fmt.Sprintf(\"Failed to override policy check.\\n%s\", runURL), err)\n\t\t\t\t}\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 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":448,"sourceCodeEnd":484,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote/backend_common.go#L448-L484","documentation":"In checkPolicy()'s soft-failed branch: the interactive override confirmation (b.confirm) returned an error that is not errRunOverridden. This means the prompt to ask the user to type 'override' itself failed — e.g. the input read errored or the run was discarded externally while waiting — so the override could not be completed.","triggerScenarios":"During an interactive apply where a soft policy failed and is overridable, b.confirm() is called to prompt 'Do you want to override...'; it returns an error other than errRunOverridden (e.g. UIIn.Input failed, the run was discarded via UI mid-prompt, or context canceled in a non-clean way).","commonSituations":"Terminal/EOF closed while the override prompt was waiting; the run was discarded or approved via the web UI concurrently, making the prompt stale; a broken interactive UI in the embedding tool.","solutions":["Re-run the apply; if the run was concurrently resolved in the UI, start a fresh run.","Perform the override directly in the HCP/TFE UI via the run URL shown.","Ensure the terminal/embedding environment provides a working interactive input (UIIn).","Use `terraform apply -auto-approve` (with override permission granted) to skip the interactive prompt."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"func isRunOverriddenMarker(err error) bool {\n    return errors.Is(err, errRunOverridden)\n}","tryCatchPattern":"err = b.confirm(stopCtx, op, opts, r, \"override\")\nif err != nil && err != errRunOverridden {\n    return fmt.Errorf(\"Failed to override: %w\\n%s\", err, runURL)\n}","preventionTips":["Provide a working interactive UI (UIIn) when relying on the override prompt.","Use `terraform apply -auto-approve` with override permission to skip the prompt.","Avoid resolving the run concurrently in the UI while the CLI prompt is open."],"tags":["policy","input","sentinel","override"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}