hashicorp/terraform · error
Error parsing provider ID from Registry
Error message
Error parsing provider ID from Registry: %s
What it means
Thrown in didyoumean (LookupMovedProvider) after fetching the moved-provider record from the registry: the response body.Id cannot be parsed by addrs.ParseProviderSourceString. The registry is expected to return a canonical provider source string in 'id'; if it is malformed the provider-move lookup cannot proceed. The %s is the diagnostics error.
Solutions
- Point Terraform at the official HashiCorp registry or a known-compatible private registry.
- Check the private registry's response for the 'id' field and ensure it is a canonical provider source string.
- Upgrade the registry implementation or Terraform to compatible versions.
- Report the response payload (without credentials) to the registry operator.
Example fix
# before (custom registry returns bad id)
cliconfigurations { /* private registry with malformed id */ }
# after (verify/fix registry response)
# curl -H "Authorization: Bearer $TOKEN" https://registry.example/v1/providers/-/aws/versions
# ensure body.id == "registry.example/hashicorp/aws" Defensive patterns
Strategy: validation
Validate before calling
// Validate the registry 'id' field shape before trusting it.
// if _, diags := addrs.ParseProviderSourceString(body.Id); diags.HasErrors() {
// return fmt.Errorf("registry returned malformed provider id %q", body.Id)
// } Try / catch
// Treat a malformed moved-provider response as 'no move' and surface a clear message.
// moved, newAddr, err := LookupMovedProvider(...)
// if err != nil && strings.Contains(err.Error(), "Error parsing provider ID from Registry") {
// // log and degrade gracefully instead of aborting
// log.Printf("[WARN] registry returned malformed moved-provider record: %v", err)
// return originalAddr, nil
// } Prevention
- Use the official HashiCorp registry or a compliant private registry.
- Ensure the registry's 'id' field is a canonical HOSTNAME/NAMESPACE/TYPE string.
- Upgrade registry and Terraform to mutually compatible versions.
When it happens
Trigger: The registry responds 200 with JSON whose 'id' field is empty, truncated, or not a valid 'HOSTNAME/NAMESPACE/TYPE' provider source string; ParseProviderSourceString returns diagnostics.
Common situations: Misconfigured or custom registry returning non-standard IDs; registry schema change/bug; network MITM or proxy rewriting the body; pointing Terraform at an incompatible private registry.
Related errors
- Failed to marshal state to json
- failed to retrieve authentication checksums for provider
- Failed to set state store provider configuration
- invalid response content from mirror server
- no releases match the given constraints
AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11).
Data as JSON: /api/errors/0618d40121946620.
Report an issue: GitHub.
Appendix: source
Thrown at internal/getproviders/didyoumean.go:245
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())
}
if provider.Type != typeName {
return "", "", fmt.Errorf("Registry returned provider with type %q, expected %q", provider.Type, typeName)
}
var movedTo addrs.Provider
if body.MovedTo != "" {
movedTo, diags = addrs.ParseProviderSourceString(body.MovedTo)
if diags.HasErrors() {
return "", "", fmt.Errorf("Error parsing provider ID from Registry: %s", diags.Err())
}
if movedTo.Type != typeName {
return "", "", fmt.Errorf("Registry returned provider with type %q, expected %q", movedTo.Type, typeName)
}
}
View on GitHub (pinned to d32a084675)