{"record":{"id":"ff4f3f39a938f8df","repo":"hashicorp/terraform","slug":"when-installing-providers-described-in-the-config","errorCode":null,"errorMessage":"When installing providers described in the config Terraform couldn't determine what 'safe init' action should be taken and returned action type %T. This is a bug in Terraform and should be reported.","messagePattern":"When installing providers described in the config Terraform couldn't determine what 'safe init' action should be taken and returned action type %T\\. This is a bug in Terraform and should be reported\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/command/meta_backend.go","lineNumber":3190,"sourceCode":"\t\t\t\t\ttfdiags.Error,\n\t\t\t\t\t\"Missing lock for state store provider\",\n\t\t\t\t\tfmt.Sprintf(`Terraform is initializing a state store for the first time in a non-interactive mode but no lock was found for the state store provider.\n%s\n\n%s\n\n%s`,\n\t\t\t\t\t\tlockfileProblem,\n\t\t\t\t\t\tguidance,\n\t\t\t\t\t\tremediationInstructions,\n\t\t\t\t\t),\n\t\t\t\t))\n\t\t\t\treturn diags\n\t\t\t}\n\t\t}\n\tdefault:\n\t\t// Handle Invalid or unexpected action types\n\t\tpanic(fmt.Sprintf(\"When installing providers described in the config Terraform couldn't determine what 'safe init' action should be taken and returned action type %T. This is a bug in Terraform and should be reported.\", trust))\n\t}\n\n\treturn diags\n}\n\n// promptStateStorageProviderApproval is used when Terraform is unsure about the safety of the provider downloaded for state storage\n// purposes, and we need to prompt the user to approve or reject using it.\nfunc (m *Meta) promptStateStorageProviderApproval(stateStorageProvider addrs.Provider, locksAfterInstall *depsfile.Locks, authResult *getproviders.PackageAuthenticationResult) tfdiags.Diagnostics {\n\tvar diags tfdiags.Diagnostics\n\n\t// If we can receive input then we prompt for ok from the user\n\tlock := locksAfterInstall.Provider(stateStorageProvider)\n\n\tvar hashList strings.Builder\n\tfor _, hash := range lock.PreferredHashes() {\n\t\thashList.WriteString(fmt.Sprintf(\"- %s\\n\", hash))\n\t}\n","sourceCodeStart":3172,"sourceCodeEnd":3208,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/command/meta_backend.go#L3172-L3208","documentation":"Programmer-error panic in confirmProviderIsTrusted: the trust value (ProviderTrust) returned by determineIfProviderTrusted is neither Trusted nor RequiresApproval (nor the values handled above), so the switch default fires. The message includes the concrete type %T so the unexpected action can be identified. Labeled explicitly as a Terraform bug.","triggerScenarios":"An internal change that introduces a new ProviderTrust enum value without extending this switch, or a nil/uninitialized trust value reaching confirmProviderIsTrusted.","commonSituations":"Terraform internal refactor of the ProviderTrust type; mismatched versions between packages; experimental safe-init logic returning an extended action type.","solutions":["Report as a Terraform bug with the %T value from the panic message.","Upgrade or downgrade Terraform to a self-consistent build.","Run with -safe-init disabled or in interactive mode if available as a workaround."],"exampleFix":"// before (library code)\ndefault:\n    panic(fmt.Sprintf(\"...returned action type %T. This is a bug in Terraform...\", trust))\n\n// after (defensive)\ndefault:\n    return diags.Append(tfdiags.Sourceless(tfdiags.Error, \"Unknown safe-init action\", fmt.Sprintf(\"action type %T\", trust)))","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Defensive: unknown trust action -> ask for approval instead of panic\ndefer func() {\n    if r := recover(); r != nil {\n        diags = diags.Append(tfdiags.Sourceless(tfdiags.Error, \"Unknown safe-init action\", fmt.Sprintf(\"%v\", r)))\n    }\n}()","preventionTips":["Use a self-consistent Terraform build (CLI/plugin SDK versions aligned).","Avoid experimental safe-init flags unless documented.","Report the %T value from the message to maintainers."],"tags":["terraform","state-store","panic","internal-bug","safe-init","trust-action"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}