{"record":{"id":"7fae7ba4cc4cbe8e","repo":"hashicorp/terraform","slug":"state-store-provider-q-s-has-unknown-supply-mo","errorCode":null,"errorMessage":"State store provider %q (%s) has unknown supply mode %q. This is a bug in Terraform and should be reported.","messagePattern":"State store provider %q \\((.+?)\\) has unknown supply mode %q\\. This is a bug in Terraform and should be reported\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/configs/state_store.go","lineNumber":173,"sourceCode":"\t\tpanic(\"This run has no dependency lock information provided at all. This is a bug in Terraform and should be reported.\")\n\t}\n\tif reqs == nil {\n\t\tpanic(\"This run has no required providers information provided at all. This is a bug in Terraform and should be reported.\")\n\t}\n\n\tif supplyMode.NotManagedByTerraform() {\n\t\t// If the provider is not managed by Terraform then it's not lockable.\n\t\t// If the working directory was initialized in the same way then the PSS provider will not be reflected in the lock file.\n\t\t// Skip them.\n\t\tswitch supplyMode {\n\t\tcase getproviders.BuiltIn:\n\t\t\tlog.Printf(\"[DEBUG] StateStore.VerifyDependencySelection: skipping %s because it's a built-in provider\", ss.ProviderAddr)\n\t\tcase getproviders.DevOverride:\n\t\t\tlog.Printf(\"[DEBUG] StateStore.VerifyDependencySelection: skipping %s because it's supplied via developer overrides\", ss.ProviderAddr)\n\t\tcase getproviders.Reattached:\n\t\t\tlog.Printf(\"[DEBUG] StateStore.VerifyDependencySelection: skipping %s because it's re-attached and not managed by Terraform\", ss.ProviderAddr)\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"State store provider %q (%s) has unknown supply mode %q. This is a bug in Terraform and should be reported.\", ss.ProviderAddr.Type, ss.ProviderAddr.ForDisplay(), supplyMode))\n\t\t}\n\t\treturn diags\n\t}\n\n\t// From this point on the provider currently in use is managed by Terraform\n\t//\n\t// When the PSS provider is managed, Terraform needs the state storage provider to be present in the lock file,\n\t// and the lock file should not be empty or missing.\n\tif depLocks.Empty() {\n\t\tdiags = diags.Append(tfdiags.Sourceless(\n\t\t\ttfdiags.Error,\n\t\t\t\"Inconsistent dependency lock file\",\n\t\t\tfmt.Sprintf(`The provider dependency used for state storage is missing from the lock file despite being present in the current configuration:\n  - provider %s: required by this configuration but no version is selected\n\nTo make the initial dependency selections that will initialize the dependency lock file, run:\n  terraform init`,\n\t\t\t\tss.ProviderAddr,","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/configs/state_store.go#L155-L191","documentation":"StateStore.VerifyDependencySelection (internal/configs/state_store.go:161) enters a branch when supplyMode.NotManagedByTerraform() is true and switches over the supply mode to log a debug message for BuiltIn/DevOverride/Reattached. Any other value panics. Critically, NotManagedByTerraform() (supplymode.go:31) returns true for everything except ManagedByTerraform — including the Unset/empty-string value — so an undetermined supply mode falls into this branch and hits the panic.","triggerScenarios":"VerifyDependencySelection is called with getproviders.Unset (empty ProviderSupplyMode) — i.e. DetermineProviderSupplyMode was never called for the state-store provider, or the provider's supply mode was not propagated from the installer into the state-store config — so NotManagedByTerraform() is true but the inner switch has no case for Unset.","commonSituations":"A state-store provider referenced in a state_store block whose installation path did not classify it as built-in/reattached/dev_override/managed; misconfigured TF_REATTACH_PROVIDERS or dev_override that leaves the mode unset; a code regression that drops the DetermineProviderSupplyMode call before verification.","solutions":["Ensure DetermineProviderSupplyMode(isDevOverride, isReattached, isBuiltin) is invoked and its result is propagated into StateStore.ProviderSupplyMode before VerifyDependencySelection runs.","Run 'terraform init' so the provider installation is classified and the supply mode is recorded; clear .terraform/ and the CLI config dev_overrides/reattach entries if stale.","Check your terraformrc / TF_REATTACH_PROVIDERS for partial config that leaves the provider unclassified.","Report upstream: add an explicit case for getproviders.Unset (or treat Unset as ManagedByTerraform/error) so the panic becomes a diagnostic."],"exampleFix":"// before\nswitch supplyMode {\ncase getproviders.BuiltIn:\n    ...\ncase getproviders.DevOverride:\n    ...\ncase getproviders.Reattached:\n    ...\ndefault:\n    panic(fmt.Sprintf(\"State store provider %q (%s) has unknown supply mode %q. ...\", ...))\n}\n\n// after (explicit handling of Unset -> actionable diagnostic)\ncase getproviders.Unset:\n    return diags.Append(tfdiags.Sourceless(tfdiags.Error,\n        \"State store provider supply mode not determined\",\n        fmt.Sprintf(\"Run 'terraform init' so %s can be classified.\", ss.ProviderAddr)))","handlingStrategy":"validation","validationCode":"// Ensure the supply mode is determined before calling VerifyDependencySelection.\nfunc classifySupplyMode(installed providerInstallation) getproviders.ProviderSupplyMode {\n    return getproviders.DetermineProviderSupplyMode(\n        installed.IsDevOverride, installed.IsReattached, installed.IsBuiltin)\n}\nif supplyMode == getproviders.Unset {\n    return diags.Append(tfdiags.Sourceless(tfdiags.Error,\n        \"State store provider supply mode not determined\",\n        \"Run 'terraform init' before this operation.\"))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run 'terraform init' so the provider is installed and its supply mode is recorded.","Call DetermineProviderSupplyMode and store its result in StateStore.ProviderSupplyMode during config loading.","Keep TF_REATTACH_PROVIDERS / dev_overrides CLI config consistent and complete so the mode resolves to a known constant."],"tags":["panic","state-store","provider-supply","exhaustive-switch","init","internal-bug"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}