{"record":{"id":"0618d40121946620","repo":"hashicorp/terraform","slug":"error-parsing-provider-id-from-registry-s","errorCode":null,"errorMessage":"Error parsing provider ID from Registry: %s","messagePattern":"Error parsing provider ID from Registry: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/getproviders/didyoumean.go","lineNumber":245,"sourceCode":"\t\treturn \"\", \"\", c.errUnauthorized(placeholderProviderAddr.Hostname)\n\tdefault:\n\t\treturn \"\", \"\", c.errQueryFailed(placeholderProviderAddr, errors.New(resp.Status))\n\t}\n\n\ttype ResponseBody struct {\n\t\tId      string `json:\"id\"`\n\t\tMovedTo string `json:\"moved_to\"`\n\t}\n\tvar body ResponseBody\n\n\tdec := json.NewDecoder(resp.Body)\n\tif err := dec.Decode(&body); err != nil {\n\t\treturn \"\", \"\", c.errQueryFailed(placeholderProviderAddr, err)\n\t}\n\n\tprovider, diags := addrs.ParseProviderSourceString(body.Id)\n\tif diags.HasErrors() {\n\t\treturn \"\", \"\", fmt.Errorf(\"Error parsing provider ID from Registry: %s\", diags.Err())\n\t}\n\n\tif provider.Type != typeName {\n\t\treturn \"\", \"\", fmt.Errorf(\"Registry returned provider with type %q, expected %q\", provider.Type, typeName)\n\t}\n\n\tvar movedTo addrs.Provider\n\tif body.MovedTo != \"\" {\n\t\tmovedTo, diags = addrs.ParseProviderSourceString(body.MovedTo)\n\t\tif diags.HasErrors() {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"Error parsing provider ID from Registry: %s\", diags.Err())\n\t\t}\n\n\t\tif movedTo.Type != typeName {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"Registry returned provider with type %q, expected %q\", movedTo.Type, typeName)\n\t\t}\n\t}\n","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/getproviders/didyoumean.go#L227-L263","documentation":"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).","triggerScenarios":"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.","commonSituations":"Using a private registry that returns non-standard provider IDs; registry API version mismatch; a registry bug returning malformed JSON for the 'id' field.","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'."],"exampleFix":"// before\nprovider \"consul\" {}   // unqualified -> triggers legacy lookup\n// after\nprovider {\n  source = \"hashicorp/consul\"\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// MissingProviderSuggestion already swallows this; if you call the client\n// directly, treat a legacy-lookup error as 'no suggestion'.\nsuggested := getproviders.MissingProviderSuggestion(ctx, addr, source, reqs)\n// 'suggested' is always a valid address; suggestion failures never propagate.","preventionTips":["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."],"tags":["registry","provider","parsing","legacy"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}