hashicorp/terraform · error
Failed to override: %w %s
Error message
Failed to override: %w %s
What it means
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).
Source
Thrown at internal/cloud/backend_common.go:418
!pc.Actions.IsOverridable || !pc.Permissions.CanOverride {
return fmt.Errorf("%s soft failed.\n%s", msgPrefix, runURL)
}
if op.AutoApprove {
if _, err = b.client.PolicyChecks.Override(stopCtx, pc.ID); err != nil {
return b.generalError(fmt.Sprintf("Failed to override policy check.\n%s", runURL), err)
}
} else if !b.input {
return errPolicyOverrideNeedsUIConfirmation
} else {
opts := &terraform.InputOpts{
Id: "override",
Query: "\nDo you want to override the soft failed policy check?",
Description: "Only 'override' will be accepted to override.",
}
err = b.confirm(stopCtx, op, opts, r, "override")
if err != nil && err != errRunOverridden {
return fmt.Errorf("Failed to override: %w\n%s\n", err, runURL)
}
if err != errRunOverridden {
if _, err = b.client.PolicyChecks.Override(stopCtx, pc.ID); err != nil {
return b.generalError(fmt.Sprintf("Failed to override policy check.\n%s", runURL), err)
}
} else {
runURL := fmt.Sprintf(runHeader, b.Hostname, b.Organization, op.Workspace, r.ID)
b.CLI.Output(fmt.Sprintf("The run needs to be manually overridden or discarded.\n%s\n", runURL))
}
}
if b.CLI != nil {
b.CLI.Output("------------------------------------------------------------------------")
}
default:
return fmt.Errorf("Unknown or unexpected policy state: %s", pc.Status)
}View on GitHub (pinned to c9def3e214)
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.
Defensive patterns
Strategy: retry
Validate before calling
// Avoid concurrent mutation of the run during the override prompt. // Serialize operations on a workspace with a lock.
Try / catch
// Re-fetch the run on confirm failure and retry if still overridable.
if err != nil && err != errRunOverridden {
r, _ = b.client.Runs.Read(ctx, r.ID)
if stillOverridable(r) { return retryOverride(ctx, r) }
return err
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- %s soft failed. %s
- %s errored.
- %s hard failed.
- Unknown or unexpected policy state: %s
- error loading workspace: %w
AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07).
Data as JSON: /api/errors/d99cac74c2d692df.
Report an issue: GitHub.