{"record":{"id":"94bf10f96953e132","repo":"hashicorp/packer","slug":"plugin-source-has-a-type-with-the-q-prefix-which","errorCode":null,"errorMessage":"Plugin source has a type with the %q prefix, which isn't valid.\nIf you are the author of this plugin, rename it to not include the prefix.\nEx: %q","messagePattern":"Plugin source has a type with the %q prefix, which isn't valid\\.\nIf you are the author of this plugin, rename it to not include the prefix\\.\nEx: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hcl2template/addrs/plugin.go","lineNumber":195,"sourceCode":"\t\t\t// syntactically-valid plugin type, so we don't end up advising\n\t\t\t// the user to try something that would be invalid for another\n\t\t\t// reason anyway.\n\t\t\t// (This is mainly just for robustness, because the validation\n\t\t\t// we already did above should've rejected most/all ways for\n\t\t\t// the suggestedType to end up invalid here.)\n\t\t\tsuggestedType := strings.Replace(givenName, userErrorPrefix, \"\", -1)\n\t\t\tif _, err := ParsePluginPart(suggestedType); err == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Plugin source has a type with the prefix %q, which isn't valid.\\n\"+\n\t\t\t\t\t\"Although that prefix is often used in the names of version control repositories \"+\n\t\t\t\t\t\"for Packer plugins, plugin source strings should not include it.\\n\"+\n\t\t\t\t\t\"\\nDid you mean %q?\", userErrorPrefix, suggestedType)\n\t\t\t}\n\t\t}\n\t\t// Otherwise, probably instead an incorrectly-named plugin, perhaps\n\t\t// arising from a similar instinct to what causes there to be\n\t\t// thousands of Python packages on PyPI with \"python-\"-prefixed\n\t\t// names.\n\t\treturn nil, fmt.Errorf(\"Plugin source has a type with the %q prefix, which isn't valid.\\n\"+\n\t\t\t\"If you are the author of this plugin, rename it to not include the prefix.\\n\"+\n\t\t\t\"Ex: %q\",\n\t\t\tredundantPrefix,\n\t\t\tstrings.Replace(givenName, redundantPrefix, \"\", 1))\n\t}\n\n\tplug := &Plugin{\n\t\tSource: str,\n\t}\n\tif len(plug.Parts()) > 16 {\n\t\treturn nil, fmt.Errorf(\"The source URL must have at most 16 components, and the one provided has %d.\\n\"+\n\t\t\t\"This is unsupported by Packer, please consider using a source that has less components to it.\\n\"+\n\t\t\t\"If this is a blocking issue for you, please open an issue to ask for supporting more \"+\n\t\t\t\"components to the source URI.\",\n\t\t\tlen(plug.Parts()))\n\t}\n\n\treturn plug, nil","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/hcl2template/addrs/plugin.go#L177-L213","documentation":"When a type segment starts with a redundant prefix (like 'packer-plugin-' or 'packer-provisioner-') that would NOT produce a valid suggestion via ParsePluginPart, Packer still rejects it, telling plugin authors to rename rather than offering a suggestion. This covers prefixes that leave an invalid remainder (e.g. residual underscores).","triggerScenarios":"ParsePluginSourceString given a type with a redundant component prefix whose stripped result still fails validation, e.g. 'github.com/org/packer-plugin-my_data'.","commonSituations":"Plugin authors who published repos with prefix plus invalid characters (underscores); users referencing such badly-named plugins.","solutions":["If you are the plugin author, rename the plugin/repository to drop the prefix and use only letters, digits, and single dashes","If you are a user, pin an older release or ask the author to rename; then reference the corrected type","Strip the prefix manually and validate the remaining type characters yourself"],"exampleFix":"// before\nsource = \"github.com/org/packer-plugin-my_data\"\n// after\nsource = \"github.com/org/my-data\"","handlingStrategy":"validation","validationCode":"name := src[strings.LastIndex(src, \"/\")+1:]\nfor _, p := range []string{\"packer-plugin-\", \"packer-provisioner-\", \"packer-builder-\"} {\n  if strings.HasPrefix(name, p) { name = strings.TrimPrefix(name, p) }\n}\n// validate name has only [a-zA-Z0-9-] before use","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Plugin authors: name repos 'packer-plugin-<type>' and publish the type without the prefix","Sanitize renamed plugins to valid identifiers","Document the canonical source string in your plugin README"],"tags":["validation","plugin-source","plugin-authoring","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"}