hashicorp/terraform · error
Error parsing provider ID from Registry: %s
Error message
Error parsing provider ID from Registry: %s
What it means
Raised in registryClient.legacyProviderDefaultNamespace (internal/getproviders/didyoumean.go:245). When looking up a legacy/default-namespace provider, the registry returns a JSON body whose 'id' field should be a parseable provider source string. If addrs.ParseProviderSourceString reports diagnostics on that 'id', this error wraps them. It is returned from the lookup and, in the normal MissingProviderSuggestion flow, swallowed (the suggestion falls back to the original address).
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 c9def3e214)
Solutions
- Use a fully-qualified provider address (namespace/type) so the legacy lookup is never invoked.
- Verify the registry implementation conforms to the Terraform registry protocol for the legacy-provider endpoint.
- If calling the client directly, treat a lookup error as 'no suggestion' and fall back to the original address (as MissingProviderSuggestion already does).
- Check the registry server logs / response body for a malformed 'id'.
Example fix
// before
provider "consul" {} // unqualified -> triggers legacy lookup
// after
provider {
source = "hashicorp/consul"
} Defensive patterns
Strategy: fallback
Try / catch
// MissingProviderSuggestion already swallows this; if you call the client // directly, treat a legacy-lookup error as 'no suggestion'. suggested := getproviders.MissingProviderSuggestion(ctx, addr, source, reqs) // 'suggested' is always a valid address; suggestion failures never propagate.
Prevention
- Use fully-qualified provider addresses (namespace/type) so legacy lookup is never invoked.
- Do not depend on MissingProviderSuggestion for correctness; it is best-effort.
- Validate registry responses conform to the protocol if you operate a registry.
When it happens
Trigger: A custom or misconfigured registry responds to the legacy-provider endpoint with an 'id' that is not a valid provider source (e.g. 'foo/bar/baz/qux' with too many parts, empty segments, or illegal characters). Direct callers of the registry client would observe the error directly.
Common situations: Using a private registry that returns non-standard provider IDs; registry API version mismatch; a registry bug returning malformed JSON for the 'id' field.
Related errors
- Registry returned provider with type %q, expected %q
- can't use local directory %q as a module registry address
- checksum list has invalid SHA256 hash %q: %s
- failed to retrieve credentials for %s: %s
- must be two words separated by an underscore
AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07).
Data as JSON: /api/errors/0618d40121946620.
Report an issue: GitHub.