hashicorp/terraform · error
no releases match the given constraints
Error message
no releases match the given constraints %s
What it means
During `terraform providers mirror`, for each required provider the command queries source.AvailableVersions and filters by versions.MeetingConstraints(constraints). If the call succeeds but yields zero candidates, this error is set (then wrapped into the 'Provider not available' Sourceless diagnostic). It specifically means the registry had versions but none matched the configured version constraint string.
Solutions
- Loosen or correct the version constraint in required_providers to match a published version (check the registry UI or terraform providers mirror -platform ... output).
- Confirm the source address is correct (registry.terraform.io/<ns>/<name>) and the registry has the expected versions.
- Remove a yanked version from the constraint or pin to a specific known-good release.
- Re-run terraform init -upgrade to let the resolver pick the newest compatible version, then mirror.
Example fix
// before: no version matches '~> 9.0'
required_providers { example = { version = "~> 9.0" } }
// after
required_providers { example = { version = "~> 3.0" } } Defensive patterns
Strategy: validation
Validate before calling
// Check that the registry has a version matching the constraint before mirroring.
avail, _, err := source.AvailableVersions(ctx, provider)
if err == nil && len(avail.Filter(versions.MeetingConstraints(constraints))) == 0 {
return fmt.Errorf("no published %s version matches %s; widen the constraint", provider, constraints)
} Prevention
- Pin to conservative version constraints (~>) rather than exact future versions.
- Verify the provider source address and registry before mirroring.
- Run terraform init -upgrade to let the resolver pick a valid version first.
When it happens
Trigger: providers mirror loops over reqs; source.AvailableVersions returns (avail, _, nil); avail.Filter(acceptable) is empty because no published version satisfies the required_providers version constraint (e.g. ~> 5.50 but only 5.0–5.30 published, or >= 2.0 with only 1.x available).
Common situations: Over-constrained required_providers (>= X.Y where no such release exists); typo in version; provider moved registries and the new source has different version history; mirroring right after a yank/deprecation of the only matching release.
Related errors
- action schema not found for action
- Error parsing provider ID from Registry
- Error: unsupported data source
- Error: unsupported resource
- error when obtaining provider instance during state store…
AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11).
Data as JSON: /api/errors/65608ae8d9e09eda.
Report an issue: GitHub.
Appendix: source
Thrown at internal/command/providers_mirror.go:162
// - It ignores what's already present and just always downloads everything
// that the configuration requires. This is a command intended to be run
// infrequently to update a mirror, so it doesn't need to optimize away
// fetches of packages that might already be present.
for provider, constraints := range reqs {
if provider.IsBuiltIn() {
c.Ui.Output(fmt.Sprintf("- Skipping %s because it is built in to Terraform CLI", provider.ForDisplay()))
continue
}
constraintsStr := getproviders.VersionConstraintsString(constraints)
c.Ui.Output(fmt.Sprintf("- Mirroring %s...", provider.ForDisplay()))
// First we'll look for the latest version that matches the given
// constraint, which we'll then try to mirror for each target platform.
acceptable := versions.MeetingConstraints(constraints)
avail, _, err := source.AvailableVersions(ctx, provider)
candidates := avail.Filter(acceptable)
if err == nil && len(candidates) == 0 {
err = fmt.Errorf("no releases match the given constraints %s", constraintsStr)
}
if err != nil {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Provider not available",
fmt.Sprintf("Failed to download %s from its origin registry: %s.", provider.String(), err),
))
continue
}
selected := candidates.Newest()
if !lockedDeps.Empty() && parsedArgs.LockFile {
selected = lockedDeps.Provider(provider).Version()
c.Ui.Output(fmt.Sprintf(" - Selected v%s to match dependency lock file", selected.String()))
} else if len(constraintsStr) > 0 {
c.Ui.Output(fmt.Sprintf(" - Selected v%s to meet constraints %s", selected.String(), constraintsStr))
} else {
c.Ui.Output(fmt.Sprintf(" - Selected v%s with no constraints", selected.String()))
}View on GitHub (pinned to d32a084675)