{"record":{"id":"48371b4b1e584bec","repo":"hashicorp/terraform","slug":"failed-to-override-w-s-48371b","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_taskStages.go","lineNumber":203,"sourceCode":"\t\treturn true, nil\n\t}\n\treturn false, errs\n}\n\nfunc (b *Cloud) processStageOverrides(context *IntegrationContext, output IntegrationOutputWriter, taskStageID string) (bool, error) {\n\tif b.CLI != nil {\n\t\tb.CLI.Output(\"--------------------------------\\n\")\n\t\tb.CLI.Output(b.Colorize().Color(fmt.Sprintf(\"%c%c [bold]Override\", Arrow, Arrow)))\n\t}\n\topts := &terraform.InputOpts{\n\t\tId:          fmt.Sprintf(\"%c%c [bold]Override\", Arrow, Arrow),\n\t\tQuery:       \"\\nDo you want to override the failed policies?\",\n\t\tDescription: \"Only 'override' will be accepted to override.\",\n\t}\n\trunURL := fmt.Sprintf(taskStageHeader, b.Hostname, b.Organization, context.Op.Workspace, context.Run.ID)\n\terr := b.confirm(context.StopContext, context.Op, opts, context.Run, \"override\")\n\tif err != nil && err != errRunOverridden {\n\t\treturn false, fmt.Errorf(\"Failed to override: %w\\n%s\\n\", err, runURL)\n\t}\n\n\tif err != errRunOverridden {\n\t\tif _, err = b.client.TaskStages.Override(context.StopContext, taskStageID, tfe.TaskStageOverrideOptions{}); err != nil {\n\t\t\treturn false, b.generalError(fmt.Sprintf(\"Failed to override policy check.\\n%s\", runURL), err)\n\t\t} else {\n\t\t\treturn true, nil\n\t\t}\n\t} else {\n\t\toutput.Output(fmt.Sprintf(\"The run needs to be manually overridden or discarded.\\n%s\\n\", runURL))\n\t}\n\treturn false, nil\n}\n","sourceCodeStart":185,"sourceCodeEnd":217,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/cloud/backend_taskStages.go#L185-L217","documentation":"Thrown by Cloud.processStageOverrides when b.confirm (the interactive override confirmation prompt) returns an error other than errRunOverridden. The override workflow asks the user to type 'override'; if the input fails, is cancelled, or hits an I/O error, the wrapped error is returned along with the run URL.","triggerScenarios":"The override confirmation prompt (`Do you want to override the failed policies?`) fails: user enters something other than 'override' and aborts, stdin is closed/non-interactive (no TTY), the context is cancelled, or the input reader errors. errRunOverridden is deliberately excluded (it has its own handling path).","commonSituations":"Running Terraform non-interactively (CI/pipe) where the override prompt cannot be answered; user typed 'no' or Ctrl-C at the prompt; stdin redirected from /dev/null; a scripted run that doesn't supply the override input.","solutions":["If overriding interactively, type exactly 'override' at the prompt.","In non-interactive contexts, supply the override input via stdin or use the auto-approve mechanism appropriate to your Terraform version.","Avoid the prompt entirely by fixing the policy/task failure so override is unnecessary.","If the prompt is unwinnable in your environment, discard the run and start fresh after fixing the policy."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Skip the override prompt in non-interactive contexts; require a TTY.\nif !isInteractive {\n    return errors.New(\"override requires an interactive terminal; fix the policy instead\")\n}","typeGuard":null,"tryCatchPattern":"err := b.confirm(ctx, op, opts, run, \"override\")\nif err != nil && err != errRunOverridden {\n    return false, fmt.Errorf(\"Failed to override: %w\\n%s\\n\", err, runURL)\n}","preventionTips":["Answer the override prompt with exactly 'override'.","Avoid override in CI; fix policy failures instead.","Supply override input via stdin in scripted runs if override is required."],"tags":["terraform","run-tasks","policy","override","interactive","input"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}