{"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":"error_code","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/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/getproviders/didyoumean.go#L227-L263","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before (custom registry returns bad id)\ncliconfigurations { /* private registry with malformed id */ }\n\n# after (verify/fix registry response)\n# curl -H \"Authorization: Bearer $TOKEN\" https://registry.example/v1/providers/-/aws/versions\n# ensure body.id == \"registry.example/hashicorp/aws\"","handlingStrategy":"validation","validationCode":"// Validate the registry 'id' field shape before trusting it.\n// if _, diags := addrs.ParseProviderSourceString(body.Id); diags.HasErrors() {\n//     return fmt.Errorf(\"registry returned malformed provider id %q\", body.Id)\n// }","typeGuard":null,"tryCatchPattern":"// Treat a malformed moved-provider response as 'no move' and surface a clear message.\n// moved, newAddr, err := LookupMovedProvider(...)\n// if err != nil && strings.Contains(err.Error(), \"Error parsing provider ID from Registry\") {\n//     // log and degrade gracefully instead of aborting\n//     log.Printf(\"[WARN] registry returned malformed moved-provider record: %v\", err)\n//     return originalAddr, nil\n// }","preventionTips":["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."],"tags":["provider","registry","moved","json"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}