amir20/dozzle · error
password is required
Error message
password is required
What it means
The `dozzle generate` command produces a users.yml config block. After optionally prompting for a password, if the password is still empty the command refuses to generate users with an empty credential and returns this error instead of writing an invalid user entry.
Solutions
- Provide a non-empty password: pipe it in (`echo 'mypassword' | dozzle generate`) or type it at the prompt
- Check that the environment variable feeding the pipe is actually set before invoking the command
- If non-interactive, ensure stdin contains at least one non-empty line
Example fix
// before unset PASSWORD echo "$PASSWORD" | dozzle generate // after export PASSWORD=mypassword echo "$PASSWORD" | dozzle generate
Defensive patterns
Strategy: validation
Validate before calling
if [ -z "$PASSWORD" ]; then echo 'PASSWORD is empty' >&2; exit 1; fi echo "$PASSWORD" | dozzle generate
Prevention
- Always set and check the password variable before piping to dozzle generate
- Test the generate command with the same stdin setup used in CI
When it happens
Trigger: Running `dozzle generate` when stdin is a terminal but the user submits an empty password, or when stdin is piped/redirected and contains only whitespace/newlines, so readPassword() trims it to "".
Common situations: CI scripts piping an empty or missing password variable (`echo "$EMPTY_VAR" | dozzle generate`); users pressing Enter at the Password prompt; scripted setups where the env var holding the password is unset.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- username is required
- Failed to save alert
- Toast id is required when once is true
- invalid credentials
- registry requires authentication
AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07).
Data as JSON: /api/errors/6dec2b8e5f0344b9.
Report an issue: GitHub.
Appendix: source
Thrown at internal/support/cli/generate_command.go:41
}
func (g *GenerateCmd) Run(args Args, embeddedCerts embed.FS) error {
writer := zerolog.NewConsoleWriter()
log.Logger = log.Output(writer)
StartEvent(args, "", nil, "generate")
if args.Generate.Username == "" {
return fmt.Errorf("username is required")
}
password := args.Generate.Password
if password == "" {
var err error
if password, err = readPassword(); err != nil {
return err
}
}
if password == "" {
return fmt.Errorf("password is required")
}
buffer := auth.GenerateUsers(auth.User{
Username: args.Generate.Username,
Password: password,
Name: args.Generate.Name,
Email: args.Generate.Email,
Filter: args.Generate.Filter,
RolesConfigured: args.Generate.RolesConfigured,
}, true)
if _, err := os.Stdout.Write(buffer.Bytes()); err != nil {
return fmt.Errorf("failed to write to stdout: %w", err)
}
return nil
}
View on GitHub (pinned to d9463cbe21)