hashicorp/terraform · error

resp.Status

Error message

resp.Status

What it means

Emitted from the 'did you mean' provider lookup (getproviders.didyoumean). After a provider address is not found, Terraform queries the registry's moved/renamed endpoint to suggest alternatives; this is the default branch of the status switch, fired for any HTTP status other than 200/404/401/403. The raw resp.Status text becomes the error message.

Source

Thrown at internal/getproviders/didyoumean.go:229

	placeholderProviderAddr := addrs.NewLegacyProvider(typeName)

	resp, err := c.httpClient.Do(req)
	if err != nil {
		return "", "", c.errQueryFailed(placeholderProviderAddr, err)
	}
	defer resp.Body.Close()

	switch resp.StatusCode {
	case http.StatusOK:
		// Great!
	case http.StatusNotFound:
		return "", "", ErrProviderNotFound{
			Provider: placeholderProviderAddr,
		}
	case http.StatusUnauthorized, http.StatusForbidden:
		return "", "", c.errUnauthorized(placeholderProviderAddr.Hostname)
	default:
		return "", "", c.errQueryFailed(placeholderProviderAddr, errors.New(resp.Status))
	}

	type ResponseBody struct {
		Id      string `json:"id"`
		MovedTo string `json:"moved_to"`
	}
	var body ResponseBody

	dec := json.NewDecoder(resp.Body)
	if err := dec.Decode(&body); err != nil {
		return "", "", c.errQueryFailed(placeholderProviderAddr, err)
	}

	provider, diags := addrs.ParseProviderSourceString(body.Id)
	if diags.HasErrors() {
		return "", "", fmt.Errorf("Error parsing provider ID from Registry: %s", diags.Err())
	}

View on GitHub (pinned to c9def3e214)

Solutions

  1. Retry `terraform init` after a short wait; transient 5xx/429 usually clear.
  2. Check https://status.hashicorp.com for registry incidents.
  3. Verify proxy/firewall egress to registry.terraform.io:443 and inspect any proxy interception.
  4. Configure a local/filesystem provider mirror (cli config provider_installation) so init does not need the registry.
  5. Reduce concurrent CI workers hitting the registry simultaneously to avoid 429s.

Example fix

# use a local mirror to avoid registry dependency
# ~/.terraformrc:
provider_installation {
  filesystem_mirror {
    path = "/usr/local/share/terraform/plugins"
  }
  direct { exclude = ["registry.terraform.io/*/*"] }
}
Defensive patterns

Strategy: retry

Try / catch

# wrap provider resolution in a retry loop from CI; the didyoumean call is transient
# shell (CI):
#   for i in 1 2 3; do terraform init && break || sleep $((i*15)); done

Prevention

When it happens

Trigger: Running `terraform init` (or any provider resolution) when the registry responds with 500, 502, 503, 429, or any non-standard code to the moved-endpoint GET request.

Common situations: registry.terraform.io partial outage or maintenance; corporate HTTP proxy returning a block page (e.g. 407/451); rate limiting from many parallel CI pipelines; transient gateway errors.

Related errors


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