{"record":{"id":"29e0d8b76cc7b923","repo":"hashicorp/packer","slug":"cannot-use-multiple-consecutive-dashes","errorCode":null,"errorMessage":"cannot use multiple consecutive dashes","messagePattern":"cannot use multiple consecutive dashes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hcl2template/addrs/plugin.go","lineNumber":84,"sourceCode":"\n\t// We're going to process the given name using the same \"IDNA\" library we\n\t// use for the hostname portion, since it already implements the case\n\t// folding rules we want.\n\t//\n\t// The idna library doesn't expose individual label parsing directly, but\n\t// once we've verified it doesn't contain any dots we can just treat it\n\t// like a top-level domain for this library's purposes.\n\tif strings.ContainsRune(given, '.') {\n\t\treturn \"\", fmt.Errorf(\"dots are not allowed\")\n\t}\n\n\t// We don't allow names containing multiple consecutive dashes, just as\n\t// a matter of preference: they look confusing, or incorrect.\n\t// This also, as a side-effect, prevents the use of the \"punycode\"\n\t// indicator prefix \"xn--\" that would cause the IDNA library to interpret\n\t// the given name as punycode, because that would be weird and unexpected.\n\tif strings.Contains(given, \"--\") {\n\t\treturn \"\", fmt.Errorf(\"cannot use multiple consecutive dashes\")\n\t}\n\n\tresult, err := idna.Lookup.ToUnicode(given)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"must contain only letters, digits, and dashes, and may not use leading or trailing dashes: %w\", err)\n\t}\n\n\treturn result, nil\n}\n\n// IsPluginPartNormalized compares a given string to the result of ParsePluginPart(string)\nfunc IsPluginPartNormalized(str string) (bool, error) {\n\tnormalized, err := ParsePluginPart(str)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif str == normalized {\n\t\treturn true, nil","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/hcl2template/addrs/plugin.go#L66-L102","documentation":"ParsePluginPart normalizes one component (host, org, type, or name) of a Packer plugin source address using IDNA lookup. It rejects strings containing '--' because consecutive dashes look confusing and would trigger the IDNA 'xn--' punycode interpretation path. This is a deliberate validation rule, not a bug.","triggerScenarios":"Calling ParsePluginPart (directly, or indirectly via ParsePluginSourceString or checkPluginNameNormalized) with a string containing two or more consecutive dashes, e.g. 'github.com/hashicorp/packer--plugin--foo'.","commonSituations":"Typos in plugin source addresses in required_plugins blocks; users copying repository names like 'packer-plugin-some--name'; attempts to encode separators with dashes; punycode/internationalized domain names containing '--'.","solutions":["Remove or replace consecutive dashes in the plugin source component with single dashes or other allowed characters","Use only letters, digits, and single dashes, with no leading/trailing dashes","If the real repository name contains '--', reference it via a different identifier or rename the repository/plugin"],"exampleFix":"// before\nsource \"github.com/hashicorp/packer--plugin--amazon\"\n// after\nsource \"github.com/hashicorp/packer-plugin-amazon\"","handlingStrategy":"validation","validationCode":"func validPluginPart(s string) bool { return !strings.Contains(s, \"--\") }","typeGuard":"func isSafePluginPart(s string) bool { return s != \"\" && !strings.Contains(s, \"--\") }","tryCatchPattern":null,"preventionTips":["Lint required_plugins source strings for '--' before running packer init","Derive plugin types from repo names by replacing separators with single dashes","Never copy repository names with double dashes directly into sources"],"tags":["validation","plugin-source","idna","hcl2"],"backgroundTag":"invalid-plugin-source-address","analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}