dgraph-io/dgraph · error
the two typed passwords do not match
Error message
the two typed passwords do not match
What it means
Returned by AskUserPassword when confirmation is requested (times == 2) and the retyped password differs from the first entry. The two interactive reads via term.ReadPassword must match exactly before the password is accepted.
Source
Thrown at x/x.go:1243
fmt.Printf("%s password for %v:", pwdType, userid)
pd, err := term.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
return "", errors.Wrapf(err, "while reading password")
}
fmt.Println()
password := string(pd)
if times == 2 {
fmt.Printf("Retype %s password for %v:", strings.ToLower(pwdType), userid)
pd2, err := term.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
return "", errors.Wrapf(err, "while reading password")
}
fmt.Println()
password2 := string(pd2)
if password2 != password {
return "", errors.Errorf("the two typed passwords do not match")
}
}
return password, nil
}
// GetPassAndLogin uses the given credentials and client to perform the login operation.
func GetPassAndLogin(dg *dgo.Dgraph, opt *CredOpt) error {
password := opt.Password
if len(password) == 0 {
var err error
password, err = AskUserPassword(opt.UserID, "Current", 1)
if err != nil {
return err
}
}
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
if err := dg.LoginIntoNamespace(ctx, opt.UserID, password, opt.Namespace); err != nil {View on GitHub (pinned to 759e242be6)
Solutions
- Re-run and retype the identical password carefully
- Paste the password from a secret manager instead of typing it
- Check for caps lock / keyboard layout issues; note the prompts hide input
Defensive patterns
Strategy: validation
Validate before calling
// no pre-call check possible; mitigate with secret-manager input
if os.Getenv("USE_SECRET_MANAGER") == "1" {
password = fetchFromSecretManager()
} Try / catch
pw, err := getPasswordFromUser(user, 2)
if err != nil && strings.Contains(err.Error(), "do not match") {
fmt.Println("Passwords did not match — please retry carefully (check caps lock).")
return retryPrompt()
} Prevention
- Paste passwords from a secret manager instead of typing
- Watch for caps lock and keyboard layout when typing hidden input
- Use generated secrets delivered via files/env for automation
When it happens
Trigger: GetPasswordFromUser with times==2 where password2 != password, i.e. the user mistyped on the 'Retype' prompt.
Common situations: Manual password entry with caps-lock/keyboard-layout differences, autocorrect or paste truncation, or copy-pasting only part of a generated secret.
Related errors
- Password too short, i.e. should have at least 6 chars
- Invalid password/crypted string
- NQuad failed sanity check. Subject: %q, Predicate: %q, Objec
- empty variable name in function call
- empty facetKeys not allowed
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/ac83ca9c2507b970.
Report an issue: GitHub.