{"record":{"id":"27d790b31f3e17b0","repo":"mattermost-community/focalboard","slug":"no-user-ids","errorCode":null,"errorMessage":"No User IDs","messagePattern":"No User IDs","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/app/auth.go","lineNumber":69,"sourceCode":"\treturn a.store.GetActiveUserCount(secondsAgo)\n}\n\n// GetUser gets an existing active user by id.\nfunc (a *App) GetUser(id string) (*model.User, error) {\n\tif len(id) < 1 {\n\t\treturn nil, errors.New(\"no user ID\")\n\t}\n\n\tuser, err := a.store.GetUserByID(id)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to find user\")\n\t}\n\treturn user, nil\n}\n\nfunc (a *App) GetUsersList(userIDs []string) ([]*model.User, error) {\n\tif len(userIDs) == 0 {\n\t\treturn nil, errors.New(\"No User IDs\")\n\t}\n\n\tusers, err := a.store.GetUsersList(userIDs, a.config.ShowEmailAddress, a.config.ShowFullName)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to find users\")\n\t}\n\treturn users, nil\n}\n\n// Login create a new user session if the authentication data is valid.\nfunc (a *App) Login(username, email, password, mfaToken string) (string, error) {\n\tvar user *model.User\n\tif username != \"\" {\n\t\tvar err error\n\t\tuser, err = a.store.GetUserByUsername(username)\n\t\tif err != nil && !model.IsErrNotFound(err) {\n\t\t\ta.metrics.IncrementLoginFailCount(1)\n\t\t\treturn \"\", errors.Wrap(err, \"invalid username or password\")","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/mattermost-community/focalboard/blob/a84bbb65e32edf972856b329417096ac413518e9/server/app/auth.go#L51-L87","documentation":"GetUsersList rejects calls with an empty or nil userIDs slice. The App layer short-circuits before hitting the store, since a bulk lookup of zero IDs is meaningless. Pure input validation.","triggerScenarios":"Calling a.GetUsersList(nil) or a.GetUsersList([]string{}) — e.g. building the ID list from board members and receiving none.","commonSituations":"Bulk user resolution after filtering out deleted/missing members; collectors that append user IDs into a slice left empty.","solutions":["Check len(userIDs) == 0 before calling and return early with an empty result","Ensure the upstream ID collection actually populates the slice"],"exampleFix":"// before\nusers, err := app.GetUsersList(ids)\n// after\nif len(ids) == 0 {\n    users = []*model.User{}\n} else {\n    users, err = app.GetUsersList(ids)\n}","handlingStrategy":"validation","validationCode":"if len(userIDs) == 0 {\n    return []*model.User{}, nil\n}","typeGuard":"func hasUserIDs(ids []string) bool { return len(ids) > 0 }","tryCatchPattern":"users, err := a.GetUsersList(ids)\nif err != nil {\n    if err.Error() == \"No User IDs\" {\n        users = []*model.User{}\n    } else {\n        return errors.Wrap(err, \"get users list failed\")\n    }\n}","preventionTips":["Treat empty bulk-ID lists as valid empty results and short-circuit","Collect IDs with a nil-safe accumulator","Add table-driven tests covering empty input slices"],"tags":["validation","auth","empty-input"],"backgroundTag":"missing-required-parameter","analyzedSha":"a84bbb65e32edf972856b329417096ac413518e9","analyzedAt":"2026-08-30T09:22:20.720Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}