hashicorp/terraform · error
Can't ask approval for state migration when interactive inpu
Error message
Can't ask approval for state migration when interactive input is disabled. Please remove the "-input=false" option and try again.
What it means
Returned by backendMigrateState (meta_backend_migrate.go:437) — the generic state-migration confirmation path. When opts.force is false the code must ask the user to approve copying/overwriting state, but if m.input is false (input disabled) it cannot prompt and returns errInteractiveInputDisabled. This covers both the empty-destination and non-empty-destination confirm cases (backendMigrateEmptyConfirm / backendMigrateNonEmptyConfirm).
Source
Thrown at internal/command/meta_backend_migrate.go:437
confirmFunc = m.backendMigrateEmptyConfirm
}
// Both states are non-empty, meaning we need to determine which
// state should be used and update accordingly.
case !source.Empty() && !destination.Empty():
log.Print("[TRACE] backendMigrateState: both source and destination workspaces have states, so might overwrite destination with source")
confirmFunc = m.backendMigrateNonEmptyConfirm
}
if confirmFunc == nil {
panic("confirmFunc must not be nil")
}
if !opts.force {
// Abort if we can't ask for input.
if !m.input {
log.Print("[TRACE] backendMigrateState: can't prompt for input, so aborting migration")
return errors.New(strings.TrimSpace(errInteractiveInputDisabled))
}
// Confirm with the user whether we want to copy state over
confirm, err := confirmFunc(sourceState, destinationState, opts)
if err != nil {
log.Print("[TRACE] backendMigrateState: error reading input, so aborting migration")
return err
}
if !confirm {
log.Print("[TRACE] backendMigrateState: user cancelled at confirmation prompt, so aborting migration")
return nil
}
}
// Confirmed! We'll have the statemgr package handle the migration, which
// includes preserving any lineage/serial information where possible, if
// both managers support such metadata.
log.Print("[TRACE] backendMigrateState: migration confirmed, so migrating")View on GitHub (pinned to c9def3e214)
Solutions
- Remove -input=false and run `terraform init -migrate-state` interactively to answer the prompt.
- Use `-migrate-state -force-copy` (force=true) to skip the confirmation when input is disabled.
- If you do not want migration, run `terraform init -reconfigure` to discard the previous backend state instead of migrating.
Example fix
# before terraform init -input=false -migrate-state # after (auto-approve the copy) terraform init -input=false -migrate-state -force-copy
Defensive patterns
Strategy: validation
Validate before calling
// Before `terraform init -migrate-state` non-interactively, decide the copy policy.
if nonInteractive {
args = append(args, "-force-copy") // skip confirmFunc approval
} Try / catch
out, err := exec.Command("terraform", "init", "-input=false", "-migrate-state").CombinedOutput()
if err != nil && bytes.Contains(out, []byte("interactive input is disabled")) {
// retry with -force-copy (or run interactively)
exec.Command("terraform", "init", "-input=false", "-migrate-state", "-force-copy").Run()
} Prevention
- Pair -migrate-state with -force-copy whenever you run with -input=false in automation.
- Prefer `terraform init -reconfigure` when you do not actually need to migrate state.
When it happens
Trigger: Running `terraform init -migrate-state` (or changing the backend block and running init) with -input=false, where the source has state that needs approval to copy/overwrite into the destination.
Common situations: Switching backend type (e.g. local -> s3, s3 -> local, s3 -> another s3 bucket) in CI with -input=false; the destination already has state so overwrite approval is required.
Related errors
- Error asking for input to configure backend %q: %s
- input is disabled
- Migrating state from HCP Terraform or Terraform Enterprise t
- error starting operation: %s
- Failed to load the backend state file: %s
AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07).
Data as JSON: /api/errors/45c02ae092a2472a.
Report an issue: GitHub.