{"record":{"id":"ca2abd08f9be3636","repo":"goharbor/harbor","slug":"failed-to-load-system-ldap-config-v","errorCode":null,"errorMessage":"failed to load system ldap config, %v","messagePattern":"failed to load system ldap config, (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"src/core/auth/ldap/ldap.go","lineNumber":247,"sourceCode":"\t\tif strings.Contains(u.Username, \"@\") {\n\t\t\tu.Email = u.Username\n\t\t}\n\t}\n\tu.Password = \"12345678AbC\" // Password is not kept in local db\n\tu.Comment = \"from LDAP.\"   // Source is from LDAP\n\n\treturn l.userMgr.Onboard(ctx, u)\n}\n\n// SearchUser -- Search user in ldap\nfunc (l *Auth) SearchUser(ctx context.Context, username string) (*models.User, error) {\n\tvar user models.User\n\ts, err := ldapCtl.Ctl.Session(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = s.Open(); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load system ldap config, %v\", err)\n\t}\n\tdefer s.Close()\n\tlUsers, err := s.SearchUser(username)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to search user in ldap\")\n\t}\n\n\tif len(lUsers) > 1 {\n\t\tlog.Warningf(\"There are more than one user found, return the first user\")\n\t}\n\tif len(lUsers) > 0 {\n\t\tuser.Username = strings.TrimSpace(lUsers[0].Username)\n\t\tuser.Realname = strings.TrimSpace(lUsers[0].Realname)\n\t\tuser.Email = strings.TrimSpace(lUsers[0].Email)\n\n\t\tlog.Debugf(\"Found ldap user %v\", user)\n\t} else {\n\t\treturn nil, errors.NotFoundError(nil).WithMessagef(\"no user found: %v\", username)","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/core/auth/ldap/ldap.go#L229-L265","documentation":"Error \"failed to load system ldap config, %v\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/core/auth/ldap/ldap.go:247 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}