{"record":{"id":"f29e269fd623c80f","repo":"hashicorp/terraform","slug":"provider-installation-was-canceled-by-an-interrupt","errorCode":null,"errorMessage":"Provider installation was canceled by an interrupt signal.","messagePattern":"Provider installation was canceled by an interrupt signal\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/init.go","lineNumber":541,"sourceCode":"\t\t\t// 2. Call the shared callback for FetchPackageSuccess\n\t\t\tcb := fetchPackageSuccessCallback(view)\n\t\t\tcb(provider, version, localDir, authResult)\n\t\t},\n\t\tProvidersLockUpdated: providersLockUpdatedCallback(&c.incompleteProviders),\n\t\tProvidersFetched:     providersFetchedCallback(view),\n\t}\n\tctx = evts.OnContext(ctx)\n\n\tmode := providercache.InstallNewProvidersOnly\n\tif upgrade {\n\t\tmode = providercache.InstallUpgrades\n\t}\n\n\t// Determine which required providers are already downloaded, and download any\n\t// new providers or newer versions of providers\n\tlock, err := inst.EnsureProviderVersions(ctx, previousLocks, req, mode)\n\tif ctx.Err() == context.Canceled {\n\t\tdiags = diags.Append(fmt.Errorf(\"Provider installation was canceled by an interrupt signal.\"))\n\t\tview.Diagnostics(diags)\n\t\treturn true, nil, Invalid, nil, diags\n\t}\n\tif err != nil {\n\t\t// The errors captured in \"err\" should be redundant with what we\n\t\t// received via the InstallerEvents callbacks above, so we'll\n\t\t// just return those as long as we have some.\n\t\tif !diags.HasErrors() {\n\t\t\tdiags = diags.Append(err)\n\t\t}\n\n\t\treturn true, nil, Invalid, nil, diags\n\t}\n\n\t// Return advice to the calling code about what to do regarding safe state store provider installation\n\ttrust = c.determineIfProviderTrusted(rootModEarly.StateStore.ProviderAddr, providerLocations, previousLocks)\n\n\treturn true, lock, trust, stateStoreProviderAuthResult, diags","sourceCodeStart":523,"sourceCodeEnd":559,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/init.go#L523-L559","documentation":"Emitted by getProvidersFromPSSConfig after EnsureProviderVersions returns, when ctx.Err()==context.Canceled — meaning the state-store provider download was aborted by a cancellation of the command context, typically an interrupt signal. It is a deliberate, user-friendly replacement for whatever partial download error occurred. The command returns the diagnostic and stops (does not continue to write a lock file).","triggerScenarios":"Pressing Ctrl+C (SIGINT) or otherwise cancelling the terraform process while it is downloading/installing the pluggable state-store provider during `terraform init`. Can also occur when a parent process/scheduler cancels the context (timeout, orchestration kill).","commonSituations":"Impatient operators hitting Ctrl+C during a slow provider download over a constrained network; CI runners that enforce a per-step timeout and cancel terraform mid-download; orchestrators (e.g. automation that cancels on a longer-than-expected run).","solutions":["Re-run `terraform init`; provider downloads are resumable/idempotent and partially-downloaded packages are discarded safely.","If downloads are slow, configure a provider plugin cache (`plugin_cache_dir`) or an on-prem mirror to speed subsequent installs.","Increase or remove the CI step timeout for the init phase.","Avoid interrupting init; a cancelled install leaves no lock-file change, so retrying is safe."],"exampleFix":"# before\n$ terraform init   # then Ctrl+C while downloading\n# after\n$ terraform init   # let it finish; retry is safe","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Treat context cancellation as retriable for state-store provider install.\nif errors.Is(runErr, context.Canceled) {\n    // safe to retry; no lock file is written on cancel\n    runErr = run(\"terraform\", \"init\", \"-enable-pluggable-state-storage-experiment\")\n}","preventionTips":["Avoid interrupting init during provider download; let it complete.","Pre-warm a provider cache (plugin_cache_dir) or mirror so installs are fast.","Give CI init steps generous timeouts to avoid scheduler-induced cancellation."],"tags":["terraform-init","provider-install","interrupt","cancellation","state-store"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}