{"record":{"id":"9cc010491156e49a","repo":"hashicorp/terraform","slug":"migration-aborted-by-user","errorCode":null,"errorMessage":"Migration aborted by user.","messagePattern":"Migration aborted by user\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/meta_backend_migrate.go","lineNumber":186,"sourceCode":"\tif !migrate {\n\t\tvar err error\n\t\t// Ask the user if they want to migrate their existing remote state\n\t\tmigrate, err = m.confirm(&terraform.InputOpts{\n\t\t\tId: \"backend-migrate-multistate-to-multistate\",\n\t\t\tQuery: fmt.Sprintf(\n\t\t\t\t\"Do you want to migrate all workspaces to %q?\",\n\t\t\t\topts.DestinationType),\n\t\t\tDescription: fmt.Sprintf(\n\t\t\t\tstrings.TrimSpace(inputBackendMigrateMultiToMulti),\n\t\t\t\topts.SourceType, opts.DestinationType),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"Error asking for state migration action: %s\", err)\n\t\t}\n\t}\n\tif !migrate {\n\t\treturn fmt.Errorf(\"Migration aborted by user.\")\n\t}\n\n\t// Read all the states\n\tsourceWorkspaces, wDiags := opts.Source.Workspaces()\n\tif wDiags.HasErrors() {\n\t\treturn fmt.Errorf(strings.TrimSpace(\n\t\t\terrMigrateLoadStates), opts.SourceType, wDiags.Err())\n\t}\n\tif wDiags.HasWarnings() {\n\t\tlog.Printf(\"[WARN] backendMigrateState_S_S: warning(s) returned when getting workspaces from source backend: %s\", wDiags.ErrWithWarnings())\n\t}\n\n\t// Sort the states so they're always copied alphabetically\n\tsort.Strings(sourceWorkspaces)\n\n\t// Go through each and migrate\n\tfor _, name := range sourceWorkspaces {\n\t\t// Copy the same names","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/meta_backend_migrate.go#L168-L204","documentation":"In Meta.backendMigrateState_S_S (meta_backend_migrate.go:186), the user was asked 'Do you want to migrate all workspaces to <destination>?' and declined (confirm returned false). Terraform treats any non-confirmation as an explicit abort of the multi-state migration, so init stops. This is an intentional user decision, not a fault.","triggerScenarios":"Answering 'no' (or anything other than confirmation) at the migrate-all-workspaces prompt during a multi-state backend migration; automation feeding a non-confirming value.","commonSituations":"An operator choosing not to migrate (e.g. wanting to inspect first), running with `-reconfigure` intent but hitting the migrate prompt instead, or automation answering incorrectly.","solutions":["If you do want to migrate, re-run and confirm; or use `terraform init -migrate-state` to skip the prompt.","If you intended to discard state instead, use `terraform init -reconfigure` to reinitialize without migrating.","Verify source and destination backends are correct before confirming a migration.","Ensure automation sends a confirming value or uses the appropriate flag to avoid an accidental abort."],"exampleFix":"// before: answered 'no'  -> 'Migration aborted by user.'\n// after: terraform init -migrate-state   # to migrate, OR\nterraform init -reconfigure   # to discard saved state","handlingStrategy":"validation","validationCode":"// Decide migration vs reconfigure up front and pass the right flag to avoid an accidental abort.\nfunc chooseInitFlags(discardState bool, migrateWanted bool) []string {\n    if discardState { return []string{\"-reconfigure\"} }\n    if migrateWanted { return []string{\"-migrate-state\"} }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["If you intend to migrate, confirm the prompt or use `-migrate-state`.","If you intend to discard state, use `-reconfigure` instead of declining.","Verify source/destination backends before approving migration.","Ensure automation uses explicit flags rather than answering the prompt."],"tags":["state","migration","interactive","init"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}