{"record":{"id":"ac83ca9c2507b970","repo":"dgraph-io/dgraph","slug":"the-two-typed-passwords-do-not-match","errorCode":null,"errorMessage":"the two typed passwords do not match","messagePattern":"the two typed passwords do not match","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"x/x.go","lineNumber":1243,"sourceCode":"\tfmt.Printf(\"%s password for %v:\", pwdType, userid)\n\tpd, err := term.ReadPassword(int(os.Stdin.Fd()))\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"while reading password\")\n\t}\n\tfmt.Println()\n\tpassword := string(pd)\n\n\tif times == 2 {\n\t\tfmt.Printf(\"Retype %s password for %v:\", strings.ToLower(pwdType), userid)\n\t\tpd2, err := term.ReadPassword(int(os.Stdin.Fd()))\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Wrapf(err, \"while reading password\")\n\t\t}\n\t\tfmt.Println()\n\n\t\tpassword2 := string(pd2)\n\t\tif password2 != password {\n\t\t\treturn \"\", errors.Errorf(\"the two typed passwords do not match\")\n\t\t}\n\t}\n\treturn password, nil\n}\n\n// GetPassAndLogin uses the given credentials and client to perform the login operation.\nfunc GetPassAndLogin(dg *dgo.Dgraph, opt *CredOpt) error {\n\tpassword := opt.Password\n\tif len(password) == 0 {\n\t\tvar err error\n\t\tpassword, err = AskUserPassword(opt.UserID, \"Current\", 1)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\tif err := dg.LoginIntoNamespace(ctx, opt.UserID, password, opt.Namespace); err != nil {","sourceCodeStart":1225,"sourceCodeEnd":1261,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/x/x.go#L1225-L1261","documentation":"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.","triggerScenarios":"GetPasswordFromUser with times==2 where password2 != password, i.e. the user mistyped on the 'Retype' prompt.","commonSituations":"Manual password entry with caps-lock/keyboard-layout differences, autocorrect or paste truncation, or copy-pasting only part of a generated secret.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// no pre-call check possible; mitigate with secret-manager input\nif os.Getenv(\"USE_SECRET_MANAGER\") == \"1\" {\n    password = fetchFromSecretManager()\n}","typeGuard":null,"tryCatchPattern":"pw, err := getPasswordFromUser(user, 2)\nif err != nil && strings.Contains(err.Error(), \"do not match\") {\n    fmt.Println(\"Passwords did not match — please retry carefully (check caps lock).\")\n    return retryPrompt()\n}","preventionTips":["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"],"tags":["password","user-input","validation"],"backgroundTag":"password-mismatch","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}