hashicorp/packer · error
Invalid github.com URI %q: a Github-compatible source must b
Error message
Invalid github.com URI %q: a Github-compatible source must be in the github.com/<namespace>/<name> format.
What it means
NewGithubPlugin validates a plugin source address and requires it to resolve to exactly three parts (github.com/<namespace>/<name>). This error is returned when the address splits into a different number of components, so it is not a well-formed Github-compatible source URI.
Source
Thrown at packer/plugin-getter/github/getter.go:181
}
func (t *HostSpecificTokenAuthTransport) base() http.RoundTripper {
if t.Base != nil {
return t.Base
}
return http.DefaultTransport
}
type GithubPlugin struct {
Hostname string
Namespace string
Type string
}
func NewGithubPlugin(source *addrs.Plugin) (*GithubPlugin, error) {
parts := source.Parts()
if len(parts) != 3 {
return nil, fmt.Errorf("Invalid github.com URI %q: a Github-compatible source must be in the github.com/<namespace>/<name> format.", source.String())
}
if parts[0] != defaultHostname {
return nil, fmt.Errorf("%q doesn't appear to be a valid %q source address; check source and try again.", source.String(), defaultHostname)
}
return &GithubPlugin{
Hostname: parts[0],
Namespace: parts[1],
Type: strings.Replace(parts[2], "packer-plugin-", "", 1),
}, nil
}
func (gp GithubPlugin) RealRelativePath() string {
return path.Join(
gp.Namespace,
fmt.Sprintf("packer-plugin-%s", gp.Type),
)View on GitHub (pinned to eb36e3c3e4)
Solutions
- Write the source as github.com/<namespace>/<name> with exactly three slash-separated parts.
- Remove extra path segments (versions, subfolders) from the source; pin versions via version constraints instead.
- Use full protocol-prefixed sources (e.g. packer-plugin-... paths or other protocols) when not targeting github.com.
- Run `packer init` and read the error's %q value to see the exact malformed address.
Example fix
// before
required_plugins {
amazon = {
source = "github.com/hashicorp"
}
}
// after
required_plugins {
amazon = {
source = "github.com/hashicorp/amazon"
version = ">= 1.0.0"
}
} Defensive patterns
Strategy: validation
Validate before calling
parts := strings.Split(strings.Trim(source, "/"), "/")
if len(parts) != 3 || parts[0] != "github.com" {
return fmt.Errorf("source %q must be github.com/<namespace>/<name>", source)
} Try / catch
if err := initPlugins(); err != nil {
if strings.Contains(err.Error(), "Invalid github.com URI") { /* fix required_plugins source */ }
} Prevention
- Copy source addresses from the plugin's official documentation.
- Keep versions in `version =` constraints, never in the source path.
- Run `packer validate`/`packer init` in CI to catch malformed sources early.
When it happens
Trigger: Calling Get with a required_plugins source like "github.com/hashicorp" (missing name), "github.com/hashicorp/name/extra" (too many parts), or any address whose Parts() does not yield exactly 3 elements.
Common situations: Copy-pasting a partial plugin path in required_plugins; including a version or subpath in the source string; forgetting that github.com sources must be namespace/name only (no tag/refs).
Related errors
- %q doesn't appear to be a valid %q source address; check sou
- The `bucket_name` must be specified
- `channel` is currently a required field.
- the `bucket_name` must be specified
- the `channel_name` must be specified
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/0ba30dd1236ace48.
Report an issue: GitHub.