{"record":{"id":"f23c8a03a07096c9","repo":"hashicorp/terraform","slug":"invalid-registry-namespace-q-in-provider-matching","errorCode":null,"errorMessage":"invalid registry namespace %q in provider matching pattern %q: must either be the wildcard * or a literal namespace","messagePattern":"invalid registry namespace %q in provider matching pattern %q: must either be the wildcard \\* or a literal namespace","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/getproviders/multi_source.go","lineNumber":178,"sourceCode":"\t\t\t\tnormalHost, err := svchost.ForComparison(givenHost)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"invalid hostname in provider matching pattern %q: %s\", str, err)\n\t\t\t\t}\n\n\t\t\t\t// The remaining code below deals only with the namespace/type portions.\n\t\t\t\thost = normalHost\n\t\t\t}\n\n\t\t\tparts = parts[1:]\n\t\t}\n\n\t\tpType, err := normalizeProviderNameOrWildcard(parts[1])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid provider type %q in provider matching pattern %q: must either be the wildcard * or a provider type name\", parts[1], str)\n\t\t}\n\t\tnamespace, err := normalizeProviderNamespaceOrWildcard(parts[0])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid registry namespace %q in provider matching pattern %q: must either be the wildcard * or a literal namespace\", parts[1], str)\n\t\t}\n\n\t\tret[i] = addrs.Provider{\n\t\t\tHostname:  host,\n\t\t\tNamespace: namespace,\n\t\t\tType:      pType,\n\t\t}\n\n\t\tif ret[i].Hostname == svchost.Hostname(Wildcard) && !(ret[i].Namespace == Wildcard && ret[i].Type == Wildcard) {\n\t\t\treturn nil, fmt.Errorf(\"invalid provider matching pattern %q: hostname can be a wildcard only if both namespace and provider type are also wildcards\", str)\n\t\t}\n\t\tif ret[i].Namespace == Wildcard && ret[i].Type != Wildcard {\n\t\t\treturn nil, fmt.Errorf(\"invalid provider matching pattern %q: namespace can be a wildcard only if the provider type is also a wildcard\", str)\n\t\t}\n\t}\n\treturn ret, nil\n}\n","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/getproviders/multi_source.go#L160-L196","documentation":"The namespace (middle segment) is normalized via normalizeProviderNamespaceOrWildcard: it must be exactly \"*\" or pass tfaddr.ParseProviderNamespace. Any other value yields this error, quoting the offending namespace and the full pattern. (Note the code reports parts[1] as the namespace value, which is the type segment, but the failure is triggered by the namespace normalization.)","triggerScenarios":"Pattern's namespace segment is invalid: uppercase, empty (double slash), or contains characters ParseProviderNamespace rejects. e.g. \"HashiCorp/aws\" or \"hashicorp//aws\".","commonSituations":"Mixed-case namespace from a provider's display name; empty namespace from a typoed double slash; disallowed punctuation in the namespace.","solutions":["Lowercase the namespace and use only allowed characters.","Fix double-slashes that produce an empty namespace segment.","Use \"*\" to wildcard the namespace (type must then also be \"*\")."],"exampleFix":"# before\ninclude = [\"HashiCorp/aws\"]\n\n# after\ninclude = [\"hashicorp/aws\"]","handlingStrategy":"validation","validationCode":"// Validate the namespace segment before parsing.\nif ns := parts[len(parts)-2]; ns != \"*\" {\n    if err := validateNamespace(ns); err != nil {\n        return fmt.Errorf(\"namespace %q invalid: %w\", ns, err)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lowercase namespaces; avoid disallowed punctuation.","Fix double-slashes that yield empty namespaces.","Wildcard the type too if you wildcard the namespace."],"tags":["config","validation","pattern"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}