{"record":{"id":"ae3bf15ae566a964","repo":"apache/answer","slug":"password-validation-failed-w","errorCode":null,"errorMessage":"password validation failed: %w","messagePattern":"password validation failed: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cli/reset_password.go","lineNumber":128,"sourceCode":"\t\temail = strings.TrimSpace(emailInput)\n\t}\n\n\tuserInfo, exist, err := userRepo.GetByEmail(ctx, email)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"query user failed: %w\", err)\n\t}\n\tif !exist {\n\t\treturn fmt.Errorf(\"user not found: %s\", email)\n\t}\n\n\tfmt.Printf(\"You are going to reset password for user: %s\\n\", email)\n\n\tpassword := strings.TrimSpace(opts.Password)\n\n\tif password != \"\" {\n\t\tprintWarning(\"Passing password via command line may be recorded in shell history\")\n\t\tif err := checker.CheckPassword(password); err != nil {\n\t\t\treturn fmt.Errorf(\"password validation failed: %w\", err)\n\t\t}\n\t} else {\n\t\tpassword, err = promptForPassword()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"password input failed: %w\", err)\n\t\t}\n\t}\n\n\tif !confirmAction(fmt.Sprintf(\"This will reset password for user '[%s]%s'. Continue?\", userInfo.DisplayName, email)) {\n\t\tfmt.Println(\"Operation cancelled\")\n\t\treturn nil\n\t}\n\n\thashPwd, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"encrypt password failed: %w\", err)\n\t}\n","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/apache/answer/blob/3b9f1370612e690a0b7f230f05e688930db4c6d3/internal/cli/reset_password.go#L110-L146","documentation":"Fires in ResetPassword when the password supplied via --password fails checker.CheckPassword (the app's shared password policy: length and character-class requirements). The guard is a validation helper; the at-fault input is the command-line password string that violates policy.","triggerScenarios":"Thrown at internal/cli/reset_password.go:128 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Review the inner CheckPassword error for the specific rule violated (length, character classes, dictionary words)","Supply a stronger password meeting the password policy (length, mixed case, digits, symbols)","Enter the password interactively when prompted instead of passing it on the command line to iterate quickly"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3b9f1370612e690a0b7f230f05e688930db4c6d3","analyzedAt":"2026-09-05T18:18:39.533Z","contentChangedAt":"2026-09-05T18:18:39.533Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}