hashicorp/packer · error
one authentication method must be specified, please referenc
Error message
one authentication method must be specified, please reference your communicator documentation
What it means
Config validation error from the null builder's Prepare: the communicator is enabled but none of ssh_agent_auth, ssh_password, or ssh_private_key_file is configured, leaving no way to authenticate. Fires when all three auth inputs are empty/false.
Source
Thrown at builder/null/config.go:53
var errs *packersdk.MultiError
if es := c.CommConfig.Prepare(nil); len(es) > 0 {
errs = packersdk.MultiErrorAppend(errs, es...)
}
if c.CommConfig.Type != "none" {
if c.CommConfig.Host() == "" {
errs = packersdk.MultiErrorAppend(errs,
fmt.Errorf("a Host must be specified, please reference your communicator documentation"))
}
if c.CommConfig.User() == "" {
errs = packersdk.MultiErrorAppend(errs,
fmt.Errorf("a Username must be specified, please reference your communicator documentation"))
}
if !c.CommConfig.SSHAgentAuth && c.CommConfig.Password() == "" && c.CommConfig.SSHPrivateKeyFile == "" {
errs = packersdk.MultiErrorAppend(errs,
fmt.Errorf("one authentication method must be specified, please reference your communicator documentation"))
}
if (c.CommConfig.SSHAgentAuth &&
(c.CommConfig.SSHPassword != "" || c.CommConfig.SSHPrivateKeyFile != "")) ||
(c.CommConfig.SSHPassword != "" && c.CommConfig.SSHPrivateKeyFile != "") {
errs = packersdk.MultiErrorAppend(errs,
fmt.Errorf("only one of ssh_agent_auth, ssh_password, and ssh_private_key_file must be specified"))
}
}
if errs != nil && len(errs.Errors) > 0 {
return nil, errs
}
return nil, nil
}
View on GitHub (pinned to eb36e3c3e4)
Solutions
- Set ssh_password or communicator.password for password auth
- Set ssh_private_key_file (or ssh_keypair_name with agent auth) for key auth
- Enable ssh_agent_auth = true to use keys loaded in your SSH agent
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at builder/null/config.go:53 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/02422d1ae230c8e6.
Report an issue: GitHub.