hashicorp/packer · error
The provided source URL is invalid. The following errors hav
Error message
The provided source URL is invalid. The following errors have been discovered: %s A valid source looks like "github.com/hashicorp/happycloud"
What it means
ParsePluginSourceString aggregates validation failures from all parts of a plugin source address and reports them together. If any part is invalid, it returns this composite error listing each problem as a '* ...' line plus an example of a valid source. It is the top-level validation gate for required_plugins source strings.
Source
Thrown at hcl2template/addrs/plugin.go:152
if url != nil && url.Scheme != "" {
errs = append(errs, "A source URL must not contain a scheme (e.g. https://).")
}
if url != nil && url.RawQuery != "" {
errs = append(errs, "A source URL must not contain a query (e.g. ?var=val)")
}
if url != nil && url.Fragment != "" {
errs = append(errs, "A source URL must not contain a fragment (e.g. #anchor).")
}
if errs != nil {
errsMsg := &strings.Builder{}
for _, err := range errs {
fmt.Fprintf(errsMsg, "* %s\n", err)
}
return nil, fmt.Errorf("The provided source URL is invalid.\nThe following errors have been discovered:\n%s\nA valid source looks like \"github.com/hashicorp/happycloud\"", errsMsg)
}
// check the 'name' portion, which is always the last part
_, givenName := path.Split(str)
_, err = ParsePluginPart(givenName)
if err != nil {
return nil, fmt.Errorf(`Invalid plugin type %q in source: %s"`, givenName, err)
}
// Due to how plugin executables are named and plugin git repositories
// are conventionally named, it's a reasonable and
// apparently-somewhat-common user error to incorrectly use the
// "packer-plugin-" prefix in a plugin source address. There is
// no good reason for a plugin to have the prefix "packer-" anyway,
// so we've made that invalid from the start both so we can give feedback
// to plugin developers about the packer- prefix being redundant
// and give specialized feedback to folks who incorrectly use the full
// packer-plugin- prefix to help them self-correct.View on GitHub (pinned to eb36e3c3e4)
Solutions
- Read the '* ...' sub-errors in the message and fix each listed component
- Match the example format 'github.com/hashicorp/happycloud' (host/org/type)
- Remove URL schemes, whitespace, and stray characters from the source string
Example fix
// before source = "https://github.com/hashicorp/happycloud" // after source = "github.com/hashicorp/happycloud"
Defensive patterns
Strategy: validation
Validate before calling
re := regexp.MustCompile(`^[a-z0-9-]+\.[a-z0-9-]+/[a-z0-9-]+/[a-z0-9-]+$`) // host/org/type shape // check re.MatchString(src) before calling packer init
Type guard
func looksLikeSource(s string) bool { return len(strings.Fields(s)) == 1 && strings.Count(s, "/") >= 2 && !strings.Contains(s, "://") } Try / catch
if _, err := addrs.ParsePluginSourceString(src); err != nil {
// print err and address each '* ...' sub-line
} Prevention
- Follow the 'github.com/org/type' shape exactly, no scheme, no spaces
- Validate template sources in CI before running packer init
- Keep one source per required_plugins entry line for clear errors
When it happens
Trigger: Calling ParsePluginSourceString (from decodeRequiredPluginsBlock, installFromServer, or RunContext) with a malformed source like 'not a source!!', 'github.com/', or an address failing host/name parsing.
Common situations: Typo'd required_plugins entries in Packer HCL2 templates; empty or truncated source strings; using URL-scheme prefixed addresses ('https://github.com/...'); missing org or name segments.
Related errors
- Plugin source has a type with the prefix %q, which isn't val
- cannot use multiple consecutive dashes
- must contain only letters, digits, and dashes, and may not u
- Invalid plugin type %q in source: %s"
- Plugin source has a type with the %q prefix, which isn't val
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/5cbec5db173b1668.
Report an issue: GitHub.