{"record":{"id":"a714aae9a43a5779","repo":"netbirdio/netbird","slug":"password-must-contain-at-least-missing","errorCode":null,"errorMessage":"password must contain at least {missing}","messagePattern":"password must contain at least (.+?)","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"management/server/user.go","lineNumber":1941,"sourceCode":"\t\t\thasUpper = true\n\t\tcase !unicode.IsLetter(c) && !unicode.IsDigit(c):\n\t\t\thasSpecial = true\n\t\t}\n\t}\n\n\tvar missing []string\n\tif !hasDigit {\n\t\tmissing = append(missing, \"one digit\")\n\t}\n\tif !hasUpper {\n\t\tmissing = append(missing, \"one uppercase letter\")\n\t}\n\tif !hasSpecial {\n\t\tmissing = append(missing, \"one special character\")\n\t}\n\n\tif len(missing) > 0 {\n\t\treturn errors.New(\"password must contain at least \" + strings.Join(missing, \", \"))\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":1923,"sourceCodeEnd":1946,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/management/server/user.go#L1923-L1946","documentation":"Returned by ValidatePassword (management/server/user.go:1941): the length rule passed but at least one required character class is missing. The message is built dynamically by joining the missing class descriptions, e.g. \"password must contain at least one digit, one special character\", so the exact text tells you precisely what to add.","triggerScenarios":"Setting a password like \"passwordpassword\" (no digit/upper/special) or \"PASSWORD123!\" (no lowercase is NOT checked, but missing lowercase letter is not a rule; the classes are digit, uppercase, special only). Any 8+ char password lacking one of: digit, uppercase letter, non-alphanumeric character.","commonSituations":"Users choosing long passphrases without symbols; generators limited to lowercase; seeding scripts with simple constants.","solutions":["Read the message: it enumerates exactly the missing classes (\"one digit\", \"one uppercase letter\", \"one special character\")","Add the missing class(es), e.g. append \"1A!\" or regenerate with all classes enabled"],"exampleFix":"// before: \"longpassphrasewithoutclasses\" -> missing digit, uppercase, special\npassword := \"longpassphrase\"\n\n// after\npassword := \"Longpassphrase1!\"","handlingStrategy":"validation","validationCode":"func passwordMeetsPolicy(pw string) error {\n    if len(pw) < 8 { return errors.New(\"too short\") }\n    var digit, upper, special bool\n    for _, c := range pw {\n        switch {\n        case unicode.IsDigit(c): digit = true\n        case unicode.IsUpper(c): upper = true\n        case !unicode.IsLetter(c) && !unicode.IsDigit(c): special = true\n        }\n    }\n    if !digit || !upper || !special {\n        return errors.New(\"password needs a digit, an uppercase letter, and a special character\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := management.ValidatePassword(pw); err != nil {\n    // message already lists exactly which classes are missing; show it verbatim to the user\n    return err\n}","preventionTips":["Show live password-policy feedback in UIs instead of relying on the server error","Generate test credentials with all character classes in CI fixtures","Remember lowercase letters are not a required class; digit, uppercase, and special are"],"tags":["management","users","password","validation","security"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}