hashicorp/terraform · error
Error asking %s: %v
Error message
Error asking %s: %v
What it means
In the confirm() helper (backend_common.go:504-508), op.UIIn.Input() returned an error while reading the user's interactive response (override confirmation, apply/discard, etc.). The error is not context.Canceled and stopCtx isn't canceled, so it's treated as a genuine input-subsystem failure rather than a clean cancel.
Source
Thrown at internal/cloud/backend_common.go:507
if err == errRunDiscarded {
err = errApplyDiscarded
if op.PlanMode == plans.DestroyMode {
err = errDestroyDiscarded
}
}
result <- err
return
}
}
}
}()
result <- func() error {
v, err := op.UIIn.Input(doneCtx, opts)
if err != nil && err != context.Canceled && stopCtx.Err() != context.Canceled {
return fmt.Errorf("Error asking %s: %v", opts.Id, err)
}
// We return the error of our parent channel as we don't
// care about the error of the doneCtx which is only used
// within this function. So if the doneCtx was canceled
// because stopCtx was canceled, this will properly return
// a context.Canceled error and otherwise it returns nil.
if doneCtx.Err() == context.Canceled || stopCtx.Err() == context.Canceled {
return stopCtx.Err()
}
// Make sure we cancel the context here so the loop that
// checks for external changes to the run is ended before
// we start to make changes ourselves.
cancel()
if v != keyword {
// Retrieve the run again to get its current status.View on GitHub (pinned to c9def3e214)
Solutions
- Ensure an interactive TTY is available when prompts are expected; in CI either provide input or use -auto-approve / -input=false appropriately.
- If using -input=false with a prompt-triggering operation, remove the operation that needs confirmation or pre-approve via -auto-approve.
- Check the wrapped %v for the specific input error (EOF, read error) and address the stdin source.
- Re-run in a proper terminal if the input subsystem errored transiently.
Example fix
// before: CI without TTY triggers interactive prompt // -> Error asking override: EOF terraform apply // after: skip interactive input terraform apply -auto-approve # or -input=false with a pre-approved run
Defensive patterns
Strategy: validation
Validate before calling
// Ensure interactive input is feasible before prompting.
func canPrompt(op *backendrun.Operation) bool {
return op.UIIn != nil && isTTY(os.Stdin)
} Try / catch
// Skip the prompt path when no TTY is present.
if !canPrompt(op) { return useAutoApproveOrAbort(op) } Prevention
- In CI, pass -auto-approve or -input=false to avoid interactive prompts.
- Provide a real TTY when interactive confirmation is required.
- Detect non-interactive stdin early and fail with a clear message.
When it happens
Trigger: Reached inside the confirm goroutine when Input() fails for a reason other than cancellation, during an interactive prompt (override, apply, destroy). The %s is opts.Id (e.g. 'override', 'approve').
Common situations: Input backend (e.g. readline/terminal) failure. Piped/non-interactive stdin when the UI expected a TTY but got EOF. Misconfigured input plugin. OS-level stdin error in CI environments that partially emulate a UI.
Related errors
- error asking for approval: %w
- Error asking %s: %v
- Failed to override: %w %s
- Failed to request username: %s
- Failed to request password: %s
AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07).
Data as JSON: /api/errors/8be562223555fed3.
Report an issue: GitHub.