{"record":{"id":"42c6cded22b54197","repo":"hashicorp/packer","slug":"only-one-of-ssh-agent-auth-ssh-password-and-ssh","errorCode":null,"errorMessage":"only one of ssh_agent_auth, ssh_password, and ssh_private_key_file must be specified","messagePattern":"only one of ssh_agent_auth, ssh_password, and ssh_private_key_file must be specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"builder/null/config.go","lineNumber":60,"sourceCode":"\t\t\terrs = packersdk.MultiErrorAppend(errs,\n\t\t\t\tfmt.Errorf(\"a Host must be specified, please reference your communicator documentation\"))\n\t\t}\n\n\t\tif c.CommConfig.User() == \"\" {\n\t\t\terrs = packersdk.MultiErrorAppend(errs,\n\t\t\t\tfmt.Errorf(\"a Username must be specified, please reference your communicator documentation\"))\n\t\t}\n\n\t\tif !c.CommConfig.SSHAgentAuth && c.CommConfig.Password() == \"\" && c.CommConfig.SSHPrivateKeyFile == \"\" {\n\t\t\terrs = packersdk.MultiErrorAppend(errs,\n\t\t\t\tfmt.Errorf(\"one authentication method must be specified, please reference your communicator documentation\"))\n\t\t}\n\n\t\tif (c.CommConfig.SSHAgentAuth &&\n\t\t\t(c.CommConfig.SSHPassword != \"\" || c.CommConfig.SSHPrivateKeyFile != \"\")) ||\n\t\t\t(c.CommConfig.SSHPassword != \"\" && c.CommConfig.SSHPrivateKeyFile != \"\") {\n\t\t\terrs = packersdk.MultiErrorAppend(errs,\n\t\t\t\tfmt.Errorf(\"only one of ssh_agent_auth, ssh_password, and ssh_private_key_file must be specified\"))\n\n\t\t}\n\t}\n\n\tif errs != nil && len(errs.Errors) > 0 {\n\t\treturn nil, errs\n\t}\n\n\treturn nil, nil\n}\n","sourceCodeStart":42,"sourceCodeEnd":71,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/builder/null/config.go#L42-L71","documentation":"Validation guard raised during the null builder's Prepare. The null builder has no machine image output, so the only thing it does is open a communicator; exactly one SSH authentication method must be configured. This error fires when the template sets more than one of ssh_agent_auth, ssh_password, and ssh_private_key_file at the same time, making the auth method ambiguous. Fix the template by keeping only one of the three communicator auth settings.","triggerScenarios":"Thrown at builder/null/config.go:60 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Keep only one auth field: either ssh_agent_auth, ssh_password, or ssh_private_key_file","If using a key file, remove the password and disable agent auth"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}