hashicorp/terraform · error

Failed to override

Error message

Failed to override: %w
%s

What it means

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.

Solutions

  1. If overriding interactively, type exactly 'override' at the prompt.
  2. In non-interactive contexts, supply the override input via stdin or use the auto-approve mechanism appropriate to your Terraform version.
  3. Avoid the prompt entirely by fixing the policy/task failure so override is unnecessary.
  4. If the prompt is unwinnable in your environment, discard the run and start fresh after fixing the policy.
Defensive patterns

Strategy: validation

Validate before calling

// Skip the override prompt in non-interactive contexts; require a TTY.
if !isInteractive {
    return errors.New("override requires an interactive terminal; fix the policy instead")
}

Try / catch

err := b.confirm(ctx, op, opts, run, "override")
if err != nil && err != errRunOverridden {
    return false, fmt.Errorf("Failed to override: %w\n%s\n", err, runURL)
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11). Data as JSON: /api/errors/48371b4b1e584bec. Report an issue: GitHub.

Appendix: source

Thrown at internal/cloud/backend_taskStages.go:203

		return true, nil
	}
	return false, errs
}

func (b *Cloud) processStageOverrides(context *IntegrationContext, output IntegrationOutputWriter, taskStageID string) (bool, error) {
	if b.CLI != nil {
		b.CLI.Output("--------------------------------\n")
		b.CLI.Output(b.Colorize().Color(fmt.Sprintf("%c%c [bold]Override", Arrow, Arrow)))
	}
	opts := &terraform.InputOpts{
		Id:          fmt.Sprintf("%c%c [bold]Override", Arrow, Arrow),
		Query:       "\nDo you want to override the failed policies?",
		Description: "Only 'override' will be accepted to override.",
	}
	runURL := fmt.Sprintf(taskStageHeader, b.Hostname, b.Organization, context.Op.Workspace, context.Run.ID)
	err := b.confirm(context.StopContext, context.Op, opts, context.Run, "override")
	if err != nil && err != errRunOverridden {
		return false, fmt.Errorf("Failed to override: %w\n%s\n", err, runURL)
	}

	if err != errRunOverridden {
		if _, err = b.client.TaskStages.Override(context.StopContext, taskStageID, tfe.TaskStageOverrideOptions{}); err != nil {
			return false, b.generalError(fmt.Sprintf("Failed to override policy check.\n%s", runURL), err)
		} else {
			return true, nil
		}
	} else {
		output.Output(fmt.Sprintf("The run needs to be manually overridden or discarded.\n%s\n", runURL))
	}
	return false, nil
}

View on GitHub (pinned to d32a084675)