{"record":{"id":"f49ffc6869a83d54","repo":"hashicorp/packer","slug":"a-username-must-be-specified-please-reference-you","errorCode":null,"errorMessage":"a Username must be specified, please reference your communicator documentation","messagePattern":"a Username must be specified, please reference your communicator documentation","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"builder/null/config.go","lineNumber":48,"sourceCode":"\t}, raws...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar errs *packersdk.MultiError\n\tif es := c.CommConfig.Prepare(nil); len(es) > 0 {\n\t\terrs = packersdk.MultiErrorAppend(errs, es...)\n\t}\n\n\tif c.CommConfig.Type != \"none\" {\n\t\tif c.CommConfig.Host() == \"\" {\n\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","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/builder/null/config.go#L30-L66","documentation":"Config validation error from the null builder's Prepare: a non-\"none\" communicator is configured with a host but no username, so SSH/WinRM has no login user. Guarded by checking CommConfig.User() == \"\".","triggerScenarios":"Thrown at builder/null/config.go:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set communicator.username (or user) to the SSH/WinRM account on the target host","Use ssh_username for legacy JSON templates","Set communicator = \"none\" if no connection is needed"],"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"}