hashicorp/packer · error

%q doesn't appear to be a valid %q source address; check sou

Error message

%q doesn't appear to be a valid %q source address; check source and try again.

What it means

NewGithubPlugin additionally requires the first address part to equal the default hostname "github.com". This error is returned when the source address is well-formed (3 parts) but its host component is not github.com, so the GitHub getter cannot handle it.

Source

Thrown at packer/plugin-getter/github/getter.go:185

		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),
	)
}

func (gp GithubPlugin) PluginType() string {
	return fmt.Sprintf("packer-plugin-%s", gp.Type)

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Ensure the source host is exactly github.com for the github getter.
  2. Use the correct protocol/hostname scheme for other forges (e.g. full URLs with supported protocols) instead of routing them through github.com addressing.
  3. Fix typos in the hostname portion of the source string.
  4. Check Packer docs/plugin listing for the correct source address format of the plugin you want.

Example fix

// before
source = "github.corp.internal/hashicorp/amazon"

// after
source = "github.com/hashicorp/amazon"
Defensive patterns

Strategy: validation

Validate before calling

parts := strings.Split(strings.Trim(source, "/"), "/")
if len(parts) == 3 && parts[0] != "github.com" {
    return fmt.Errorf("host %q is not supported by the github getter; use github.com", parts[0])
}

Try / catch

if err := initPlugins(); err != nil {
    if strings.Contains(err.Error(), "valid \"github.com\" source address") { /* correct hostname in source */ }
}

Prevention

When it happens

Trigger: Calling Get with sources like "gitlab.com/org/name", "github.corp.internal/team/plugin", or any three-part address whose parts[0] != defaultHostname being routed to the github getter.

Common situations: Using a GitHub Enterprise or other forge address that the github getter doesn't support; mixing up source schemes so a non-github address reaches the github plugin getter; typos like "gihub.com/org/name" that still pass the 3-part check only if split correctly — more commonly wrong-host entries in required_plugins.

Related errors


AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05). Data as JSON: /api/errors/0e70b42f73e3b2fe. Report an issue: GitHub.