{"record":{"id":"ebee7a8b70e48768","repo":"hashicorp/terraform","slug":"invalid-provider-type-q-in-provider-matching-patt","errorCode":null,"errorMessage":"invalid provider type %q in provider matching pattern %q: must either be the wildcard * or a provider type name","messagePattern":"invalid provider type %q in provider matching pattern %q: must either be the wildcard \\* or a provider type name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/getproviders/multi_source.go","lineNumber":174,"sourceCode":"\t\t\tgivenHost := parts[0]\n\t\t\tif givenHost == \"*\" {\n\t\t\t\thost = svchost.Hostname(Wildcard)\n\t\t\t} else {\n\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}","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/getproviders/multi_source.go#L156-L192","documentation":"Thrown when the provider-type segment (parts[1], i.e. the final segment after an optional host is stripped) is neither '*' nor accepted by addrs.ParseProviderPart. ParseProviderPart requires a lowercase name: ASCII letters and digits with internal hyphens, not starting or ending with a hyphen, not starting with a digit, and within length limits. Uppercase, underscores, dots, or a leading digit/trailing hyphen all fail.","triggerScenarios":"Patterns like 'hashicorp/AWS' (uppercase), 'hashicorp/aws_eks' (underscore), 'hashicorp/terraform-provider' is fine but 'hashicorp/-aws' (leading hyphen), 'hashicorp/aws.v2' (dot), or 'hashicorp/2aws' (leading digit). Triggered at multi_source.go:172-174 via normalizeProviderNameOrWildcard -> addrs.ParseProviderPart.","commonSituations":"Pasting a provider type with the display casing (e.g. from docs showing 'AWS'); using underscores thinking they are allowed like in other ecosystems; adding a version suffix with a dot; a trailing hyphen from truncation.","solutions":["Lowercase the type segment and use only letters, digits, and internal hyphens (e.g. 'hashicorp/aws').","Replace underscores/dots in the type with hyphens.","If you want any type, use '*' as the final segment.","Confirm the segment is the type, not the namespace — order is host?/namespace/type."],"exampleFix":"// before\ninclude = [\"hashicorp/AWS_EKS\"]\n\n// after\ninclude = [\"hashicorp/aws-eks\"]","handlingStrategy":"validation","validationCode":"import \"github.com/hashicorp/terraform/internal/addrs\"\n\nfunc validTypeSegment(t string) error {\n    if t == \"*\" {\n        return nil\n    }\n    return addrs.ParseProviderPart(t) // same rule the parser applies\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep provider types lowercase, letters/digits/internal hyphens only.","Reject underscores, dots, uppercase, and leading-digit/leading-hyphen forms in UI inputs.","Reuse addrs.ParseProviderPart as the single source of truth for validity."],"tags":["provider-config","pattern","provider-type","validation","multi-source"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}