{"record":{"id":"65608ae8d9e09eda","repo":"hashicorp/terraform","slug":"no-releases-match-the-given-constraints-s","errorCode":null,"errorMessage":"no releases match the given constraints %s","messagePattern":"no releases match the given constraints (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/providers_mirror.go","lineNumber":162,"sourceCode":"\t// - It ignores what's already present and just always downloads everything\n\t//   that the configuration requires. This is a command intended to be run\n\t//   infrequently to update a mirror, so it doesn't need to optimize away\n\t//   fetches of packages that might already be present.\n\n\tfor provider, constraints := range reqs {\n\t\tif provider.IsBuiltIn() {\n\t\t\tc.Ui.Output(fmt.Sprintf(\"- Skipping %s because it is built in to Terraform CLI\", provider.ForDisplay()))\n\t\t\tcontinue\n\t\t}\n\t\tconstraintsStr := getproviders.VersionConstraintsString(constraints)\n\t\tc.Ui.Output(fmt.Sprintf(\"- Mirroring %s...\", provider.ForDisplay()))\n\t\t// First we'll look for the latest version that matches the given\n\t\t// constraint, which we'll then try to mirror for each target platform.\n\t\tacceptable := versions.MeetingConstraints(constraints)\n\t\tavail, _, err := source.AvailableVersions(ctx, provider)\n\t\tcandidates := avail.Filter(acceptable)\n\t\tif err == nil && len(candidates) == 0 {\n\t\t\terr = fmt.Errorf(\"no releases match the given constraints %s\", constraintsStr)\n\t\t}\n\t\tif err != nil {\n\t\t\tdiags = diags.Append(tfdiags.Sourceless(\n\t\t\t\ttfdiags.Error,\n\t\t\t\t\"Provider not available\",\n\t\t\t\tfmt.Sprintf(\"Failed to download %s from its origin registry: %s.\", provider.String(), err),\n\t\t\t))\n\t\t\tcontinue\n\t\t}\n\t\tselected := candidates.Newest()\n\t\tif !lockedDeps.Empty() && parsedArgs.LockFile {\n\t\t\tselected = lockedDeps.Provider(provider).Version()\n\t\t\tc.Ui.Output(fmt.Sprintf(\"  - Selected v%s to match dependency lock file\", selected.String()))\n\t\t} else if len(constraintsStr) > 0 {\n\t\t\tc.Ui.Output(fmt.Sprintf(\"  - Selected v%s to meet constraints %s\", selected.String(), constraintsStr))\n\t\t} else {\n\t\t\tc.Ui.Output(fmt.Sprintf(\"  - Selected v%s with no constraints\", selected.String()))\n\t\t}","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/providers_mirror.go#L144-L180","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run 'terraform providers schema' or check the registry UI to list actually-available versions for the provider.","Loosen the required_providers version constraint to include a published version.","Confirm the provider source address and registry hostname are correct.","If mirroring from a private registry, authenticate with a valid TF_TOKEN_* and verify the versions it exposes."],"exampleFix":"// before\nterraform {\n  required_providers {\n    aws = { source = \"hashicorp/aws\", version = \">= 6.0\" }  # not yet published\n  }\n}\n// after\nterraform {\n  required_providers {\n    aws = { source = \"hashicorp/aws\", version = \">= 5.0\" }\n  }\n}","handlingStrategy":"validation","validationCode":"// Pre-flight: resolve available versions and confirm at least one matches the constraint before mirroring\npackage main\n\n// pseudo: use the registry API (or terraform providers schema) to list versions\nfunc constraintHasMatch(available []string, constraint string) error {\n\tc, _ := version.NewConstraint(constraint)\n\tfor _, v := range available {\n\t\tif vv, _ := version.NewVersion(v); c.Check(vv) { return nil }\n\t}\n\treturn fmt.Errorf(\"no published version satisfies %s; available: %v\", constraint, available)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer broad but bounded constraints (e.g. '~> 5.0') over exact pins for mirroring.","Authenticate to private registries with TF_TOKEN_* before 'terraform providers mirror'.","Verify the provider source address and registry hostname are correct."],"tags":["providers-mirror","version-constraint","registry","offline"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}