hashicorp/terraform · error

no releases match the given constraints %s

Error message

no releases match the given constraints %s

What it means

Returned by ProvidersMirrorCommand when source.AvailableVersions succeeded (no transport error) but candidates.Newest() has nothing to choose because avail.Filter(acceptable) is empty. It means the registry has versions of the provider but none satisfy the version_constraints declared in the configuration (required_providers). Mirroring cannot proceed without at least one matching release.

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 c9def3e214)

Solutions

  1. Run 'terraform providers schema' or check the registry UI to list actually-available versions for the provider.
  2. Loosen the required_providers version constraint to include a published version.
  3. Confirm the provider source address and registry hostname are correct.
  4. If mirroring from a private registry, authenticate with a valid TF_TOKEN_* and verify the versions it exposes.

Example fix

// before
terraform {
  required_providers {
    aws = { source = "hashicorp/aws", version = ">= 6.0" }  # not yet published
  }
}
// after
terraform {
  required_providers {
    aws = { source = "hashicorp/aws", version = ">= 5.0" }
  }
}
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: resolve available versions and confirm at least one matches the constraint before mirroring
package main

// pseudo: use the registry API (or terraform providers schema) to list versions
func constraintHasMatch(available []string, constraint string) error {
	c, _ := version.NewConstraint(constraint)
	for _, v := range available {
		if vv, _ := version.NewVersion(v); c.Check(vv) { return nil }
	}
	return fmt.Errorf("no published version satisfies %s; available: %v", constraint, available)
}

Prevention

When it happens

Trigger: Running 'terraform providers mirror' when required_providers version constraint excludes every published version — e.g. '>= 5.0' but only 4.x published, or '>= 1.2.0, < 1.3.0' with no such release, or a constraint referencing a version that was yanked from the registry.

Common situations: Pinned to a version constraint that is tighter than what the registry offers; provider not yet published at the required version; private registry lacking expected versions; typo in version string; provider was renamed/moved and the old address has no compatible releases.

Related errors


AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07). Data as JSON: /api/errors/65608ae8d9e09eda. Report an issue: GitHub.