{"record":{"id":"56753e0a20471c60","repo":"hashicorp/terraform","slug":"expected-one-provider-requirement-for-the-destinat","errorCode":null,"errorMessage":"expected one provider requirement for the destination state store provider %q, but received empty data about required providers.","messagePattern":"expected one provider requirement for the destination state store provider %q, but received empty data about required providers\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/command/state_migrate.go","lineNumber":456,"sourceCode":"\n\tif err := sMgr.WriteState(s); err != nil {\n\t\tdiags = diags.Append(errBackendWriteSavedDiag(err))\n\t\treturn diags\n\t}\n\tif err := sMgr.PersistState(); err != nil {\n\t\tdiags = diags.Append(errBackendWriteSavedDiag(err))\n\t\treturn diags\n\t}\n\n\treturn diags\n}\n\nfunc (c *StateMigrateCommand) getDestinationStateStoreProviderRequirements(provider addrs.Provider, configReqs *configs.RequiredProviders) (providerreqs.Requirements, tfdiags.Diagnostics) {\n\tvar diags tfdiags.Diagnostics\n\treq := make(providerreqs.Requirements, 1)\n\n\tif configReqs == nil {\n\t\tpanic(fmt.Sprintf(\"expected one provider requirement for the destination state store provider %q, but received empty data about required providers.\", provider))\n\t}\n\n\tfor _, providerReq := range configReqs.RequiredProviders {\n\t\tif providerReq.Type.Equals(provider) {\n\t\t\tcon, err := providerreqs.ParseVersionConstraints(providerReq.Requirement.Required.String())\n\t\t\tif err != nil {\n\t\t\t\tdiags = diags.Append(&hcl.Diagnostic{\n\t\t\t\t\tSeverity: hcl.DiagError,\n\t\t\t\t\tSummary:  \"Invalid version constraint syntax for state store provider\",\n\t\t\t\t\t// The errors returned by ParseVersionConstraint already include\n\t\t\t\t\t// the section of input that was incorrect, so we don't need to\n\t\t\t\t\t// include that here.\n\t\t\t\t\tDetail:  fmt.Sprintf(\"Incorrect version constraint syntax: %s.\", err.Error()),\n\t\t\t\t\tSubject: providerReq.Requirement.DeclRange.Ptr(),\n\t\t\t\t})\n\t\t\t}\n\t\t\treq[providerReq.Type] = con\n\t\t}","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/command/state_migrate.go#L438-L474","documentation":"This panic fires in getDestinationStateStoreProviderRequirements when the passed *configs.RequiredProviders is nil. A state_store block must declare its backing provider under required_providers, so a nil pointer means the caller (state push/list, or migration setup) failed to load/forward the configuration's required_providers block.","triggerScenarios":"State migration (terraform state migrate, or state push to a configured state_store) where the configuration containing the state_store block could not supply its RequiredProviders map. Concretely: the state_store provider lookup is invoked before config parsing finishes, or the config has a state_store block with no sibling required_providers block at all.","commonSituations":"A user writes a `state_store \"...\" { ... }` block but omits the matching `required_providers` entry, or a Terraform internal refactor passes a nil configReqs through this path. Triggered during state-migration setup, not during normal plan/apply.","solutions":["In your configuration, ensure every state_store block has a corresponding required_providers entry naming the same provider address (e.g. registry.terraform.io/hashicorp/terraform-state-store-mysql).","Run `terraform init` after editing the config so the required_providers block is parsed and forwarded to the state-store machinery.","If you maintain the calling code, guard with `if configReqs == nil { return diags-emitting error }` instead of letting it reach the panic."],"exampleFix":"// before\nrequired_providers { /* missing the state-store provider */ }\nstate_store \"mysql\" { provider = \"...\" }\n// after\nrequired_providers {\n  tfstate-mysql = {\n    source  = \"registry.terraform.io/hashicorp/terraform-state-store-mysql\"\n    version = \">= 0.1.0\"\n  }\n}\nstate_store \"mysql\" { provider = \"...\" }","handlingStrategy":"validation","validationCode":"// Caller-side guard before invoking state-store provider resolution.\nif configReqs == nil || len(configReqs.RequiredProviders) == 0 {\n  return fmt.Errorf(\"configuration has no required_providers for state store %q\", provider)\n}","typeGuard":"// n/a — pointer null-check","tryCatchPattern":null,"preventionTips":["Always pair a `state_store` block with a matching `required_providers` entry in the same module.","Run `terraform init` after adding a state_store block to validate the configuration.","Lint configurations for state_store blocks missing a sibling required_providers entry."],"tags":["terraform-cli","state-store","state-migrate","panic","invariant","required-providers"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}