{"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/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/cloud/backend_common.go#L400-L436","documentation":"In the interactive override flow, b.confirm() returned an error that is NOT errRunOverridden (which is the expected success path). The wrapped error and run URL are surfaced together so the operator can see why the confirmation prompt failed (typo in 'override' keyword, context cancel, input error) and where to recover manually.","triggerScenarios":"b.confirm(...) returns err where err != nil AND err != errRunOverridden: user typed something other than 'override'; UIIn.Input failed; stopCtx was canceled mid-prompt; input EOF on a closed stdin.","commonSituations":"Operator mistyped the override keyword; CI accidentally reached the interactive branch with a half-open TTY; SSH session dropped during the prompt.","solutions":["Type exactly 'override' (case-sensitive) when prompted, or choose the non-override option.","Use the run URL in the message to override or discard manually in the TFE/HCP UI.","If the prompt is unexpected, ensure --auto-approve is set or skip the override path."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const overrideKeyword = \"override\"\n\nfunc validOverrideInput(s string) bool { return s == overrideKeyword }","typeGuard":null,"tryCatchPattern":"err := b.confirm(ctx, op, opts, r, \"override\")\nif err != nil && err != errRunOverridden {\n    // provide manual recovery path via run URL embedded in the error\n    log.Printf(\"override prompt failed: %v\", err)\n    return err\n}","preventionTips":["Type exactly the keyword ('override') when prompted.","Keep the run URL from the error for manual UI recovery.","Avoid the interactive override path in CI—use --auto-approve."],"tags":["tfe","hcp","cloud-backend","policy","override","interactive"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}