{"record":{"id":"97696c9dfd8986af","repo":"hashicorp/terraform","slug":"errinteractiveinputdisabled","errorCode":"errInteractiveInputDisabled","errorMessage":"Can't ask approval for state migration when interactive input is disabled.\n\nPlease remove the \"-input=false\" option and try again.","messagePattern":"Can't ask approval for state migration when interactive input is disabled\\.\n\nPlease remove the \"-input=false\" option and try again\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/meta_backend_migrate.go","lineNumber":450,"sourceCode":"\t\t\tconfirmFunc = m.backendMigrateEmptyConfirm\n\t\t}\n\n\t// Both states are non-empty, meaning we need to determine which\n\t// state should be used and update accordingly.\n\tcase !source.Empty() && !destination.Empty():\n\t\tlog.Print(\"[TRACE] backendMigrateState: both source and destination workspaces have states, so might overwrite destination with source\")\n\t\tconfirmFunc = m.backendMigrateNonEmptyConfirm\n\t}\n\n\tif confirmFunc == nil {\n\t\tpanic(\"confirmFunc must not be nil\")\n\t}\n\n\tif !opts.force {\n\t\t// Abort if we can't ask for input.\n\t\tif !m.input {\n\t\t\tlog.Print(\"[TRACE] backendMigrateState: can't prompt for input, so aborting migration\")\n\t\t\treturn errors.New(strings.TrimSpace(errInteractiveInputDisabled))\n\t\t}\n\n\t\t// Confirm with the user whether we want to copy state over\n\t\tconfirm, err := confirmFunc(sourceState, destinationState, opts)\n\t\tif err != nil {\n\t\t\tlog.Print(\"[TRACE] backendMigrateState: error reading input, so aborting migration\")\n\t\t\treturn err\n\t\t}\n\t\tif !confirm {\n\t\t\tlog.Print(\"[TRACE] backendMigrateState: user cancelled at confirmation prompt, so aborting migration\")\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// Confirmed! We'll have the statemgr package handle the migration, which\n\t// includes preserving any lineage/serial information where possible, if\n\t// both managers support such metadata.\n\tlog.Print(\"[TRACE] backendMigrateState: migration confirmed, so migrating\")","sourceCodeStart":432,"sourceCodeEnd":468,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/command/meta_backend_migrate.go#L432-L468","documentation":"`backendMigrateState` returns this (constant `errInteractiveInputDisabled`) when a state migration needs user approval (single-state to/from single-state where both sides already have state, or any case requiring `confirmFunc`) but `m.input` is false and `-force` was not supplied. The message instructs the user to remove `-input=false`.","triggerScenarios":"Switching backends (e.g. local -> remote/cloud or remote -> cloud) where both source and destination already contain state, `opts.force` is false, and `m.input` is false.","commonSituations":"Re-running `terraform init` with `-input=false` after changing the `backend`/`cloud` block in a CI pipeline; migrating state in automation without `-migrate-state` plus a way to auto-confirm.","solutions":["Drop `-input=false` (or run in a TTY) so the migration prompt can be answered.","Pass `-force` (with `-migrate-state`) to skip the confirmation when you are sure the destination should be overwritten.","If you did not intend to migrate, align the backend config so init does not detect a migration is needed."],"exampleFix":"# before\nterraform init -input=false   # backend changed, both sides have state -> error\n# after\nterraform init -migrate-state -force   # or remove -input=false","handlingStrategy":"validation","validationCode":"// Mirror the guard before triggering a migration:\nif !m.input && !opts.force {\n    return errors.New(strings.TrimSpace(errInteractiveInputDisabled))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use `terraform init -migrate-state -force` for non-interactive migrations.","Avoid changing backend config in the same CI step that runs `-input=false` init.","Keep state migrations deliberate and reviewed, not automated surprises."],"tags":["backend-migration","input-disabled","interactive","state","terraform-cli","ci"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}